Skip to content

Commit

Permalink
ut: fail fast (#4630)
Browse files Browse the repository at this point in the history
Signed-off-by: bobz965 <[email protected]>
  • Loading branch information
bobz965 authored Oct 19, 2024
1 parent d02cffc commit 2ac7e2c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -1060,7 +1060,7 @@ ut:

.PHONY: cover
cover:
go test ./pkg/ovs ./pkg/util ./pkg/ipam -gcflags=all=-l -p 1 -coverprofile=cover.out -covermode=atomic
go test ./pkg/ovs ./pkg/util ./pkg/ipam -gcflags=all=-l -coverprofile=cover.out -covermode=atomic
go tool cover -func=cover.out | grep -v "100.0%"
go tool cover -html=cover.out -o cover.html

Expand Down
24 changes: 13 additions & 11 deletions pkg/ovs/ovn-nb-suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,8 @@ func emptyNbDatabaseModel() (model.ClientDBModel, error) {

func (suite *OvnClientTestSuite) SetupSuite() {
fmt.Println("set up ovn client test suite")
// setup ovn nb client
// setup ovn nb client schema
nbClientSchema := ovnnb.Schema()
nbClientDBModel, err := ovnnb.FullDatabaseModel()
require.NoError(suite.T(), err)

_, nbSock := newOVSDBServer(suite.T(), nbClientDBModel, nbClientSchema)
nbEndpoint := fmt.Sprintf("unix:%s", nbSock)
require.FileExists(suite.T(), nbSock)

ovnNBClient, err := newOvnNbClient(suite.T(), nbEndpoint, 10)
require.NoError(suite.T(), err)
suite.ovnNBClient = ovnNBClient

// setup failed case ovn nb client
emptyNbDBModel, err := emptyNbDatabaseModel()
Expand All @@ -68,6 +58,18 @@ func (suite *OvnClientTestSuite) SetupSuite() {
server1.Close()
require.NoFileExists(suite.T(), nbSock1)

// setup ovn nb client
nbClientDBModel, err := ovnnb.FullDatabaseModel()
require.NoError(suite.T(), err)

_, nbSock := newOVSDBServer(suite.T(), nbClientDBModel, nbClientSchema)
nbEndpoint := fmt.Sprintf("unix:%s", nbSock)
require.FileExists(suite.T(), nbSock)

ovnNBClient, err := newOvnNbClient(suite.T(), nbEndpoint, 10)
require.NoError(suite.T(), err)
suite.ovnNBClient = ovnNBClient

// setup ovn sb client
sbClientSchema := ovnsb.Schema()
sbClientDBModel, err := ovnsb.FullDatabaseModel()
Expand Down

0 comments on commit 2ac7e2c

Please sign in to comment.