MCPcopy
hub / github.com/minio/minio-go / TestIAMNoRoles

Function TestIAMNoRoles

pkg/credentials/iam_aws_test.go:180–192  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

178}
179
180func TestIAMNoRoles(t *testing.T) {
181 server := initTestServerNoRoles()
182 defer server.Close()
183
184 creds := NewIAM(server.URL)
185 _, err := creds.GetWithContext(defaultCredContext)
186 if err == nil {
187 t.Fatal("Unexpected should fail here")
188 }
189 if err.Error() != "No IAM roles attached to this EC2 service" {
190 t.Fatalf("Expected 'No IAM roles attached to this EC2 service', got %s", err)
191 }
192}
193
194func TestIAM(t *testing.T) {
195 server := initIMDSv2Server("2014-12-16T01:51:37Z", false)

Callers

nothing calls this directly

Calls 5

initTestServerNoRolesFunction · 0.85
NewIAMFunction · 0.85
GetWithContextMethod · 0.80
CloseMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected