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

Function TestEcsTaskFullURI

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

Source from the content-addressed store, hash-verified

301}
302
303func TestEcsTaskFullURI(t *testing.T) {
304 server := initEcsTaskTestServer("2014-12-16T01:51:37Z")
305 defer server.Close()
306 p := &IAM{}
307 t.Setenv("AWS_CONTAINER_CREDENTIALS_FULL_URI",
308 fmt.Sprintf("%s%s", server.URL, "/v2/credentials?id=task_credential_id"))
309 creds, err := p.RetrieveWithCredContext(defaultCredContext)
310 os.Unsetenv("AWS_CONTAINER_CREDENTIALS_FULL_URI")
311 if err != nil {
312 t.Errorf("Unexpected failure %s", err)
313 }
314 if creds.AccessKeyID != "accessKey" {
315 t.Errorf("Expected \"accessKey\", got %s", creds.AccessKeyID)
316 }
317
318 if creds.SecretAccessKey != "secret" {
319 t.Errorf("Expected \"secret\", got %s", creds.SecretAccessKey)
320 }
321
322 if creds.SessionToken != "token" {
323 t.Errorf("Expected \"token\", got %s", creds.SessionToken)
324 }
325
326 if !p.IsExpired() {
327 t.Error("Expected creds to be expired.")
328 }
329}
330
331func TestSts(t *testing.T) {
332 server := initStsTestServer("2014-12-16T01:51:37Z")

Callers

nothing calls this directly

Calls 5

initEcsTaskTestServerFunction · 0.85
IsExpiredMethod · 0.65
CloseMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected