Skip to content

Commit 120d56e

Browse files
committed
test: Add test for Go SDK credential provider
As a regression test for the token TTL header in MMDS response to PUT /latest/api/token, add a test that gets AWS credentials using AWS SDK for Go. Signed-off-by: Takahiro Itazuri <itazur@amazon.com>
1 parent 2f5f474 commit 120d56e

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

tests/integration_tests/functional/test_mmds.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -750,7 +750,8 @@ def test_deprecated_mmds_config(uvm_plain):
750750

751751
@pytest.mark.parametrize("version", MMDS_VERSIONS)
752752
@pytest.mark.parametrize("imds_compat", [None, False, True])
753-
def test_aws_credential_provider(uvm_plain, version, imds_compat):
753+
@pytest.mark.parametrize("sdk", ["py", "go"])
754+
def test_aws_credential_provider(uvm_plain, version, imds_compat, sdk):
754755
"""
755756
Test AWS SDK's credential provider works on MMDS
756757
"""
@@ -789,7 +790,9 @@ def test_aws_credential_provider(uvm_plain, version, imds_compat):
789790

790791
run_guest_cmd(ssh_connection, f"ip route add {DEFAULT_IPV4} dev eth0", "")
791792

792-
cmd = r"""python3 - <<EOF
793+
match sdk:
794+
case "py":
795+
cmd = r"""python3 - <<EOF
793796
import logging
794797
import sys
795798
@@ -808,5 +811,7 @@ def test_aws_credential_provider(uvm_plain, version, imds_compat):
808811
print(f"{cred.access_key},{cred.secret_key},{cred.token}")
809812
EOF
810813
"""
814+
case "go":
815+
cmd = "/usr/local/bin/go_sdk_cred_provider"
811816
_, stdout, stderr = ssh_connection.check_output(cmd)
812817
assert stdout == "AAA,BBB,CCC\n", stderr

0 commit comments

Comments
 (0)