mirror of
https://github.com/garethgeorge/backrest.git
synced 2026-08-23 09:26:31 +00:00
chore: fix tests
This commit is contained in:
@@ -7,7 +7,7 @@ assignees: ''
|
||||
|
||||
---
|
||||
|
||||
Note: if you have a question or need support please post in the [discussions area](https://github.com/garethgeorge/backrest/wiki).
|
||||
Note: if you have a question or need support please post in the [discussions area](https://github.com/garethgeorge/backrest/discussions).
|
||||
|
||||
**Describe the bug**
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
@@ -7,7 +7,7 @@ assignees: ''
|
||||
|
||||
---
|
||||
|
||||
Note: if you have a question or want discussion please post in the [discussions area](https://github.com/garethgeorge/backrest/wiki).
|
||||
Note: if you have a question or want discussion please post in the [discussions area](https://github.com/garethgeorge/backrest/discussions).
|
||||
|
||||
**Is your feature request related to a problem? Please describe.**
|
||||
A clear and concise description of what the problem is.
|
||||
|
||||
@@ -51,17 +51,20 @@ func TestUpdateConfig(t *testing.T) {
|
||||
{
|
||||
name: "good modno",
|
||||
req: &v1.Config{
|
||||
Modno: 1234,
|
||||
Modno: 1234,
|
||||
Instance: "test",
|
||||
},
|
||||
wantErr: false,
|
||||
res: &v1.Config{
|
||||
Modno: 1235,
|
||||
Modno: 1235,
|
||||
Instance: "test",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "reject when validation fails",
|
||||
req: &v1.Config{
|
||||
Modno: 1235,
|
||||
Modno: 1235,
|
||||
Instance: "test",
|
||||
Repos: []*v1.Repo{
|
||||
{},
|
||||
},
|
||||
@@ -332,7 +335,8 @@ func TestCancelBackup(t *testing.T) {
|
||||
|
||||
sut := createSystemUnderTest(t, &config.MemoryStore{
|
||||
Config: &v1.Config{
|
||||
Modno: 1234,
|
||||
Modno: 1234,
|
||||
Instance: "test",
|
||||
Repos: []*v1.Repo{
|
||||
{
|
||||
Id: "local",
|
||||
|
||||
@@ -36,6 +36,10 @@ func NewRepoOrchestrator(config *v1.Config, repoConfig *v1.Repo, resticPath stri
|
||||
}
|
||||
|
||||
var opts []restic.GenericOption
|
||||
if p := repoConfig.GetPassword(); p != "" {
|
||||
opts = append(opts, restic.WithEnv("RESTIC_PASSWORD="+p))
|
||||
}
|
||||
|
||||
opts = append(opts, restic.WithEnviron())
|
||||
opts = append(opts, restic.WithEnv("RESTIC_PROGRESS_FPS=2"))
|
||||
|
||||
@@ -45,10 +49,6 @@ func NewRepoOrchestrator(config *v1.Config, repoConfig *v1.Repo, resticPath stri
|
||||
}
|
||||
}
|
||||
|
||||
if p := repoConfig.GetPassword(); p != "" {
|
||||
opts = append(opts, restic.WithEnv("RESTIC_PASSWORD="+p))
|
||||
}
|
||||
|
||||
for _, f := range repoConfig.GetFlags() {
|
||||
args, err := shlex.Split(f)
|
||||
if err != nil {
|
||||
@@ -97,7 +97,7 @@ func (r *RepoOrchestrator) SnapshotsForPlan(ctx context.Context, plan *v1.Plan)
|
||||
ctx, flush := forwardResticLogs(ctx)
|
||||
defer flush()
|
||||
|
||||
snapshots, err := r.repo.Snapshots(ctx, restic.WithFlags("--tag", TagForPlan(plan.Id), "--tag", TagForInstance(r.config.Instance)))
|
||||
snapshots, err := r.repo.Snapshots(ctx, restic.WithFlags("--tag", TagForPlan(plan.Id)+","+TagForInstance(r.config.Instance)))
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("get snapshots for plan %q: %w", plan.Id, err)
|
||||
}
|
||||
|
||||
@@ -128,8 +128,8 @@ func TestSnapshotParenting(t *testing.T) {
|
||||
t.Errorf("expected snapshot %s to have parent %s, got %s", curr.Id, prev.Id, curr.Parent)
|
||||
}
|
||||
|
||||
if !slices.Contains(curr.Tags, tagForPlan(plan)) {
|
||||
t.Errorf("expected snapshot %s to have tag %s", curr.Id, tagForPlan(plan))
|
||||
if !slices.Contains(curr.Tags, TagForPlan(plan.Id)) {
|
||||
t.Errorf("expected snapshot %s to have tag %s", curr.Id, TagForPlan(plan.Id))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,8 +79,10 @@ func (r *Repo) pipeCmdOutputToWriter(cmd *exec.Cmd, handlers ...io.Writer) {
|
||||
handlers = append(stderrHandlers, cmd.Stderr)
|
||||
}
|
||||
|
||||
cmd.Stdout = io.MultiWriter(handlers...)
|
||||
cmd.Stderr = io.MultiWriter(handlers...)
|
||||
mw := io.MultiWriter(handlers...)
|
||||
mw = &ioutil.SynchronizedWriter{W: mw}
|
||||
cmd.Stdout = mw
|
||||
cmd.Stderr = mw
|
||||
}
|
||||
|
||||
// init initializes the repo, the command will be cancelled with the context.
|
||||
|
||||
@@ -31,7 +31,7 @@ export const GettingStartedGuide = () => {
|
||||
for details about available repository types and how they can be
|
||||
configured.
|
||||
</li>
|
||||
<li>See <a href="https://github.com/garethgeorge/backrest/wiki" target="_blank">the Backrest wiki</a> for instructions on how to configure Backrest.</li>
|
||||
<li>See <a href="https://garethgeorge.github.io/backrest" target="_blank">the Backrest wiki</a> for instructions on how to configure Backrest.</li>
|
||||
</ul>
|
||||
<Divider orientation="left">Tips</Divider>
|
||||
<ul>
|
||||
|
||||
Reference in New Issue
Block a user