Skip to content

Commit

Permalink
update test to use require instead of t.Fatal
Browse files Browse the repository at this point in the history
  • Loading branch information
garfthoffman committed Jan 27, 2025
1 parent 4726409 commit 4185122
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
17 changes: 8 additions & 9 deletions go/vt/tableacl/tableacl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"reflect"
"testing"

"github.com/stretchr/testify/require"
"google.golang.org/protobuf/proto"

"vitess.io/vitess/go/vt/tableacl/acl"
Expand Down Expand Up @@ -77,16 +78,14 @@ func TestInitWithValidConfig(t *testing.T) {
func TestInitWithEmptyConfig(t *testing.T) {
tacl := tableACL{factory: &simpleacl.Factory{}}
f, err := os.CreateTemp("", "tableacl")
if err != nil {
t.Fatal(err)
}
require.NoError(t, err)

defer os.Remove(f.Name())
if err := f.Close(); err != nil {
t.Fatal(err)
}
if err := tacl.init(f.Name(), func() {}); err == nil {
t.Fatal("tableACL config file is empty")
}
err = f.Close()
require.NoError(t, err)

err = tacl.init(f.Name(), func() {})
require.Error(t, err)
}

func TestInitFromProto(t *testing.T) {
Expand Down
1 change: 0 additions & 1 deletion go/vt/vttablet/tabletserver/tabletserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,6 @@ func (tsv *TabletServer) initACL(tableACLConfigFile string, enforceTableACLConfi
tsv.ClearQueryPlanCache()
},
)
// Log failure if either there was a problem loading the ACL, or if the ACL is empty
if err != nil {
log.Errorf("Fail to initialize Table ACL: %v", err)
if enforceTableACLConfig {
Expand Down

0 comments on commit 4185122

Please sign in to comment.