NASA-PDS / doi-service

Service and tools for generating DOIs for PDS bundles, collections, and data sets
https://nasa-pds.github.io/doi-service
Other
2 stars 3 forks source link

Some TestDoisController test cases do not pass in CI and have been disabled #364

Open alexdunnjpl opened 1 year ago

alexdunnjpl commented 1 year ago

🐛 Describe the bug

(Presumably) due to lack of jwt credentials in the Github Actions test environment's config file, some tests do not pass following #349

📜 To Reproduce

See integration tests logs

🕵️ Expected behavior

All branch integration tests pass.

🩺 Test Data / Additional context

Affected tests have been disabled in CI with @unittest.skipIf(os.environ.get("CI") == "true", "Test is currently broken in Github Actions workflow. See #364")

⚙️ Engineering Details

Need to investigate whether it's legit/simple to add jwt creds to the config, or if another approach is necessary.

alexdunnjpl commented 1 year ago

Per @ramesh-maddegoda

[API_AUTHENTICATION]
# Add the issuer of the oauth tokens, for cognito https://cognito-idp/.<aws-region>.amazonaws.com/<userpoolID>
jwt_issuer = https://cognito-idp.us-west-2.amazonaws.com/us-west-2_6cebRMo6g
# Add the entire content of the JSON file at https://cognito-idp/.<aws-region>.amazonaws.com/<userpoolID>/.well-known/jwks.json
json_web_key_set = {"keys":[{"alg":"RS256","e":"AQAB","kid":"W5PfV9Fcm85EsSW/UeCxQWJMzjWwwdI0BCb7+2OnHLg=","kty":"RSA","n":"5YBcCoj53XKUGn1Xg9VVU9MUi--9G5qIGBZEWkpOH88Eb_JiM-awUHZHySqeiA12IhUu5EcGG-UMyz2Wtt_bXpVDss3Nkg5iJa1hkbYAGjhztsHO3ZyPg8skZxJW4QCe7XDsP2VvEyQRM7R1KTQ4XuX7Dp6YkRNmP4VCSqgftlDbt0t-pp8-IZsGHTFwRH3SIko6GenuykBJ3cUSckjXRUKHgTCh7NNi2Ep12w2jmW3Jb_fxjuom4HZgmTq7FDeHA5oiCK5Q7NsCZOoJC4UbetpXfaWok-RJQBE-d8bVgeTtxVkjJeJD8MCV5I0d5L4v4pt05i9Xvhx98WyJU3jIiQ","use":"sig"},{"alg":"RS256","e":"AQAB","kid":"ayPJoLoErO3lSYCAAuDqZCjYlFnbwzE1UdXOboxZyFI=","kty":"RSA","n":"1c3SisbSozOiTCVvlaGIzzYEHkifKR-Jc41XYpd8DSULgYgPDdQUPVSpEwZiA4YxX3U7CGwsXBJEGB1HSL6rMQZytJjt-C-hHsOMeUXuwn7ahurRJXfnjv0jztmtxNHwm2qxhkYV8tyVtCv8bvcJ65tIIyH4lF5ZoQwzgn02Pku9cRjAIJcOdjSylykcGYZDfDugWmf9TtdyITNS8PSagYl86sKUhW9aj1NReWGBDij0PQkkL81yzd3qXQhqotDte63xqVGD82jToBgYo-FtIxD8n8h54pxRDrtgEiYkj0yB4UPEC9pyCpvo1L0ARhrn1u4RdGwvSbqLGNe1_mOxIQ","use":"sig"}]}
jwt_lifetime_seconds = 3600
jwt_algorithm = RS256

config defines the user pool to authenticate against, and the user (in this case, the CI workflow) needs to have an account and authenticate against that pool. Ramesh's config points to the NGAP user pool.

https://github.com/unity-sds/unity-cs/wiki/Getting-Cognito-JWT-Tokens-in-Command-Line

1) we have to create a Cognito user for CI 2) Have the user name and password of that user in a Config (preferably something like github secrets) 3) Use those credentials to get the JWT access token 4) Add that token as the Authorization header when making a request to doi-service (as "Authorization":"Bearer acces-token)"

alexdunnjpl commented 1 year ago

@ramesh-maddegoda has set up user ci-user in NGAP user pool.

Should receive an email shortly.

Change password here and pass on to Jordan.

alexdunnjpl commented 1 year ago

The rest of the info is here https://jpl.slack.com/archives/GCGR1R3A4/p1663347277214929