Skip to content

Commit

Permalink
add a flag to check if the network mutex is locked
Browse files Browse the repository at this point in the history
  • Loading branch information
Pantani authored and Pantani committed Oct 27, 2023
1 parent f721944 commit b7ca7c1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@ import (
type IntegrationTestSuite struct {
suite.Suite

net *network.Network
cfg network.Config
locked bool
net *network.Network
cfg network.Config
}

func (s *IntegrationTestSuite) network() *network.Network {
s.net = network.New(s.T(), s.cfg)
s.locked = true
return s.net
}

Expand All @@ -32,8 +34,9 @@ func (s *IntegrationTestSuite) SetupSuite() {

func (s *IntegrationTestSuite) TearDownTest() {
s.T().Log("tearing down test")
if s.net != nil {
if s.net != nil && s.locked {
s.net.Cleanup()
s.locked = false
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ func (s *IntegrationTestSuite) TestUpdate<%= TypeName.UpperCamel %>() {
}
for _, tc := range tests {
s.T().Run(tc.desc, func(t *testing.T) {
args := append([]string{}, fields...)
args := append([]string{tc.id}, fields...)
args = append(args, tc.args...)
out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdUpdate<%= TypeName.UpperCamel %>(), args)
if tc.err != nil {
Expand Down

0 comments on commit b7ca7c1

Please sign in to comment.