Skip to content

Commit

Permalink
test/deployer: add the method of deregistering services (#19525)
Browse files Browse the repository at this point in the history
  • Loading branch information
huikang authored Nov 7, 2023
1 parent 48d7d4a commit 8d6545e
Show file tree
Hide file tree
Showing 3 changed files with 255 additions and 78 deletions.
2 changes: 1 addition & 1 deletion test-integ/connect/snapshot_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ func Test_Snapshot_Restore_Agentless(t *testing.T) {
// Add a new static-server
cfg = sp.Config()
cluster = cfg.Cluster("dc1")
cluster.Nodes[3].Disabled = false // client 3 -- static-server
cluster.Nodes[3].Disabled = false // client 3 -- new static-server
require.NoError(t, sp.Relaunch(cfg))

// Ensure the static-client connected to static-server
Expand Down
17 changes: 10 additions & 7 deletions testing/deployer/sprawl/boot.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ func (s *Sprawl) assignIPAddresses() error {
return fmt.Errorf("unknown network %q", addr.Network)
}
addr.IPAddress = net.IPByIndex(node.Index)
s.logger.Info("assign addr", "node", node.Name, "addr", addr.IPAddress)
s.logger.Info("assign addr", "node", node.Name, "addr", addr.IPAddress, "enabled", !node.Disabled)
}
}
}
Expand Down Expand Up @@ -260,8 +260,11 @@ func (s *Sprawl) initConsulServers() error {
return fmt.Errorf("populateInitialConfigEntries[%s]: %w", cluster.Name, err)
}

if err := s.populateInitialResources(cluster); err != nil {
return fmt.Errorf("populateInitialResources[%s]: %w", cluster.Name, err)
if cluster.EnableV2 {
// Resources are available only in V2
if err := s.populateInitialResources(cluster); err != nil {
return fmt.Errorf("populateInitialResources[%s]: %w", cluster.Name, err)
}
}

if err := s.createAnonymousToken(cluster); err != nil {
Expand Down Expand Up @@ -300,8 +303,8 @@ func (s *Sprawl) createFirstTime() error {
return fmt.Errorf("createAllServiceTokens: %w", err)
}

if err := s.registerAllServicesForDataplaneInstances(); err != nil {
return fmt.Errorf("registerAllServicesForDataplaneInstances: %w", err)
if err := s.syncAllServicesForDataplaneInstances(); err != nil {
return fmt.Errorf("syncAllServicesForDataplaneInstances: %w", err)
}

// We can do this ahead, because we've incrementally run terraform as
Expand Down Expand Up @@ -368,8 +371,8 @@ func (s *Sprawl) preRegenTasks() error {
return fmt.Errorf("createAllServiceTokens: %w", err)
}

if err := s.registerAllServicesForDataplaneInstances(); err != nil {
return fmt.Errorf("registerAllServicesForDataplaneInstances: %w", err)
if err := s.syncAllServicesForDataplaneInstances(); err != nil {
return fmt.Errorf("syncAllServicesForDataplaneInstances: %w", err)
}

return nil
Expand Down
Loading

0 comments on commit 8d6545e

Please sign in to comment.