Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions app/auth/plugins/azure_managed_identity/outgoing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -355,12 +355,23 @@ func TestFetchTokenUsesIdentityEndpoint(t *testing.T) {
}

func TestFetchTokenMissingIdentityHeader(t *testing.T) {
t.Setenv("IDENTITY_ENDPOINT", "http://localhost/identity")
t.Setenv("IDENTITY_HEADER", "")
t.Setenv("IDENTITY_ENDPOINT", "http://localhost/identity")
t.Setenv("IDENTITY_HEADER", "")

if _, _, err := fetchToken(context.Background(), "api://res", ""); err == nil {
t.Fatal("expected error for missing identity header")
}
if _, _, err := fetchToken(context.Background(), "api://res", ""); err == nil {
t.Fatal("expected error for missing identity header")
}
}

func TestFetchTokenMissingMSISecret(t *testing.T) {
t.Setenv("IDENTITY_ENDPOINT", "")
t.Setenv("IDENTITY_HEADER", "")
t.Setenv("MSI_ENDPOINT", "http://localhost/msi")
t.Setenv("MSI_SECRET", "")

if _, _, err := fetchToken(context.Background(), "api://res", ""); err == nil {
t.Fatal("expected error for missing MSI secret")
}
}

func TestFetchTokenUsesMSIEndpoint(t *testing.T) {
Expand Down
Loading