featurebase/ctl/backup_test.go
Travis Turner d2856bfeee
Linters! (#2314)
* Add (commented out) linters that we should introduce

I went through the available linters and added (commented out) the ones
I think we should work on in the near term. In other words, fix them,
then uncomment them so they are enabled in CI.

* linter: errchkjson

* linter: ineffassign

* linter: gosimple

* linter: errname
2023-03-10 15:13:15 -06:00

33 lines
778 B
Go

// Copyright 2021 Molecula Corp. All rights reserved.
package ctl
import (
"context"
"errors"
"io"
"testing"
"github.com/featurebasedb/featurebase/v3/logger"
)
func TestBackupCommand_Run(t *testing.T) {
cmLog := logger.NewStandardLogger(io.Discard)
cm := NewBackupCommand(cmLog)
cm.OutputDir = ""
err := cm.Run(context.Background())
if !errors.Is(err, ErrUsage) {
t.Fatalf("expected usage error, got %v", err)
}
cm.OutputDir = "foo"
cm.Concurrency = 0
err = cm.Run(context.Background())
if !errors.Is(err, ErrUsage) {
t.Fatalf("expected usage error, got %v", err)
}
cm.Concurrency = 1
cm.HeaderTimeoutStr = "until the cat wakes up"
err = cm.Run(context.Background())
if !errors.Is(err, ErrUsage) {
t.Fatalf("expected usage error, got %v", err)
}
}