metis/pkg/service/remote_test.go

32 lines
1.1 KiB
Go

package service
import (
"strings"
"testing"
)
func TestMountedHostTmpDirMapsConfiguredTmpPathIntoMount(t *testing.T) {
if got := mountedHostTmpDir("/tmp/metis-flash-test"); got != "/host-tmp/metis-flash-test" {
t.Fatalf("expected /host-tmp/metis-flash-test, got %q", got)
}
if got := mountedHostTmpDir("/tmp"); got != "/host-tmp" {
t.Fatalf("expected /host-tmp, got %q", got)
}
}
func TestVaultRuntimeAnnotationsIncludeReciprocalHecateKeys(t *testing.T) {
withKeys := vaultRuntimeAnnotations(true)
template := withKeys["vault.hashicorp.com/agent-inject-template-metis-ssh-env.sh"]
if !strings.Contains(template, "METIS_SSH_KEY_HECATE_TETHYS") {
t.Fatalf("expected tethys hecate key export in vault template: %q", template)
}
if !strings.Contains(template, "METIS_SSH_KEY_HECATE_DB") {
t.Fatalf("expected db hecate key export in vault template: %q", template)
}
withoutKeys := vaultRuntimeAnnotations(false)
if _, ok := withoutKeys["vault.hashicorp.com/agent-inject-template-metis-ssh-env.sh"]; ok {
t.Fatalf("did not expect ssh key template when includeSSHKeys=false")
}
}