replace static status definition by const

This commit is contained in:
venture
2026-11-14 09:57:52 +01:00
parent 276a9fe320
commit f16363cb60
10 changed files with 65 additions and 48 deletions
+6 -5
View File
@@ -8,6 +8,7 @@ import (
"testing"
"mediarr/cluster"
"mediarr/identity"
)
func TestUpCreatesAndKeepsClusterIdentity(t *testing.T) {
@@ -25,9 +26,9 @@ func TestUpCreatesAndKeepsClusterIdentity(t *testing.T) {
t.Fatalf("Up : %v", err)
}
identity := node.ClusterIdentity()
if len(identity.PublicKey) != 32 {
t.Fatalf("clé publique de %d octets, attendu 32", len(identity.PublicKey))
clusterIdentity := node.ClusterIdentity()
if len(clusterIdentity.PublicKey) != 32 {
t.Fatalf("clé publique de %d octets, attendu 32", len(clusterIdentity.PublicKey))
}
principal, err := node.db.Queries.GetClusterPrincipal(context.Background())
@@ -40,10 +41,10 @@ func TestUpCreatesAndKeepsClusterIdentity(t *testing.T) {
if principal.Name != "cluster" {
t.Fatalf("name = %q, attendu cluster", principal.Name)
}
if principal.Status != "active" {
if principal.Status != identity.StatusActive {
t.Fatalf("status = %q, attendu active", principal.Status)
}
if !bytes.Equal(principal.PublicKey, identity.PublicKey) {
if !bytes.Equal(principal.PublicKey, clusterIdentity.PublicKey) {
t.Fatal("la clé publique en base ne correspond pas à la clé chargée")
}