Skip to content

Agent Mesh

fix auth flow tests

Antonio Ojea5d027ea2a8b7
diff --git a/cmd/sam-hub/server.go b/cmd/sam-hub/server.go
index e34fba9a..e6c17272 100644
--- a/cmd/sam-hub/server.go
+++ b/cmd/sam-hub/server.go
@@ -149,6 +149,13 @@ func handleRegisterHTTP(h *Hub) http.HandlerFunc {
return
}
+ h.gater.mu.Lock()
+ if !h.gater.authenticated[pID] {
+ samHubActiveNodes.Inc()
+ }
+ h.gater.authenticated[pID] = true
+ h.gater.mu.Unlock()
+
var authPeers []peer.ID
h.gater.mu.Lock()
for p := range h.gater.authenticated {
diff --git a/tests/e2e/auth_flows.bats b/tests/e2e/auth_flows.bats
index cfd1087b..e8456114 100644
--- a/tests/e2e/auth_flows.bats
+++ b/tests/e2e/auth_flows.bats
@@ -69,7 +69,7 @@ teardown() {
-v "${data_vol}:/root/.config/sam-mesh" \
"sam-node:local" \
run \
- --hub "/dns4/sam-hub/tcp/4002/p2p/${hub_peer_id}"
+ --hub "http://sam-hub:9090"
mesh_wait_for_log "${node_name}" "Using stored identity." 20
@@ -110,7 +110,7 @@ teardown() {
-v "${token_vol}:/var/run/secrets/tokens" \
"sam-node:local" \
run \
- --hub "/dns4/sam-hub/tcp/4002/p2p/${hub_peer_id}" \
+ --hub "http://sam-hub:9090" \
--jwt-path "/var/run/secrets/tokens/sa-token"
mesh_wait_for_log "${node_name}" "SAM Node Online" 20