Skip to content

Instantly share code, notes, and snippets.

@shoenig
Created October 3, 2023 14:51
Show Gist options
  • Save shoenig/c6a0288a6476545bf2efb739edf4f68c to your computer and use it in GitHub Desktop.
Save shoenig/c6a0288a6476545bf2efb739edf4f68c to your computer and use it in GitHub Desktop.
cluster id
diablo nomad.ent/nomad on main [m]
➜ go test -tags=ent -v -run _UpgradeMigration
=== RUN TestAutopilotEnterprise_UpgradeMigration
CLUSTERID id=a59eb8bb-556c-186c-48ec-80effdbca495 error=<nil>
--- PASS: TestAutopilotEnterprise_UpgradeMigration (0.33s)
PASS
ok github.com/hashicorp/nomad/nomad 0.353s
diablo nomad.ent/nomad on main [m]
➜ git diff
diff --git a/nomad/autopilot_ent_test.go b/nomad/autopilot_ent_test.go
index 8b5abc7192..30b6304866 100644
--- a/nomad/autopilot_ent_test.go
+++ b/nomad/autopilot_ent_test.go
@@ -145,10 +145,11 @@ func TestAutopilotEnterprise_RedundancyZone(t *testing.T) {
func TestAutopilotEnterprise_UpgradeMigration(t *testing.T) {
ci.Parallel(t)
+
s1, cleanupS1 := TestServer(t, func(c *Config) {
c.BootstrapExpect = 2
c.RaftConfig.ProtocolVersion = 3
- c.Build = "0.8.0"
+ c.Build = "1.3.0"
c.NumSchedulers = 0 // reduce log noise
})
defer cleanupS1()
@@ -156,7 +157,7 @@ func TestAutopilotEnterprise_UpgradeMigration(t *testing.T) {
s2, cleanupS2 := TestServer(t, func(c *Config) {
c.BootstrapExpect = 2
c.RaftConfig.ProtocolVersion = 3
- c.Build = "0.8.1"
+ c.Build = "1.3.1"
c.NumSchedulers = 0 // reduce log noise
})
defer cleanupS2()
diff --git a/nomad/leader.go b/nomad/leader.go
index 719160fa58..49b3f27835 100644
--- a/nomad/leader.go
+++ b/nomad/leader.go
@@ -4,6 +4,8 @@
package nomad
import (
+ "github.com/shoenig/netlog"
+
"bytes"
"context"
"fmt"
@@ -324,7 +326,8 @@ func (s *Server) establishLeadership(stopCh chan struct{}) error {
schedulerConfig := s.getOrCreateSchedulerConfig()
// Initialize the ClusterID
- _, _ = s.ClusterID()
+ id, err := s.ClusterID()
+ netlog.Yellow("CLUSTERID", "id", id, "error", err)
// todo: use cluster ID for stuff, later!
// Enable the plan queue, since we are now the leader
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment