use variable for namespace

Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
This commit is contained in:
Kristoffer Dalby 2022-10-14 12:38:34 +02:00
parent 13aa845c69
commit aef77a113c
No known key found for this signature in database

View File

@ -27,6 +27,8 @@ func TestHeadscale(t *testing.T) {
var err error
namespace := "test-space"
scenario, err := NewScenario()
if err != nil {
t.Errorf("failed to create scenario: %s", err)
@ -46,18 +48,18 @@ func TestHeadscale(t *testing.T) {
})
t.Run("create-namespace", func(t *testing.T) {
err := scenario.CreateNamespace("test-space")
err := scenario.CreateNamespace(namespace)
if err != nil {
t.Errorf("failed to create namespace: %s", err)
}
if _, ok := scenario.namespaces["test-space"]; !ok {
if _, ok := scenario.namespaces[namespace]; !ok {
t.Errorf("namespace is not in scenario")
}
})
t.Run("create-auth-key", func(t *testing.T) {
_, err := scenario.CreatePreAuthKey("test-space")
_, err := scenario.CreatePreAuthKey(namespace)
if err != nil {
t.Errorf("failed to create preauthkey: %s", err)
}