aws-samples / aws-ambit-scenario-designer-ue4

AWS Ambit Scenario Designer for Unreal Engine 4 (Ambit) is a suite of tools to streamline content creation at scale for autonomous vehicle and robotics simulation applications.
https://aws-samples.github.io/aws-ambit-scenario-designer-ue4/
Apache License 2.0
85 stars 21 forks source link

Mock calls to S3 in ConfigImportExport tests #15

Closed JuliaABurch closed 2 years ago

JuliaABurch commented 2 years ago

What was the problem/requirement? (What/Why)

Some of the ConfigImportExport tests were failing on our CI/CD pipeline because the build instance is not set up with AWS credentials with access to S3, and the tests attempt several calls to S3. Similarly, anyone who has not run aws configure locally would expect to see these tests fail.

What was the solution? (How)

As connectivity to S3 is not the feature under test -- these are unit tests, not integration tests -- I defined function references to the AWS calls so we could replace them with simple lambdas in the unit tests that don't attempt network calls.

What artifacts are related to this change?

Issues: AMBIT-3

What is the impact of this change?

Developers will no longer be required to run aws configure or otherwise setting up AWS credentials locally before being able to successfully run the ConfigImportExport tests.

Are you adding any new dependencies to the system?

No.

How were these changes tested?

  1. Without having AWS credentials configured, I ran the ConfigImportExport unit tests from the command line and ensured that all unit tests passed: .\RunUAT.bat BuildCookRun -project="ambit-demo\AmbitDemo.uproject" -unattended -clean -build -package -nullrhi -nosound -run -editortest "-RunAutomationTest=Ambit.ConfigImportExport"

  2. I then ensured all unit tests passed: .\RunUAT.bat BuildCookRun -project="ambit-demo\AmbitDemo.uproject" -unattended -clean -build -package -nullrhi -nosound -run -editortest "-RunAutomationTest=Ambit"

  3. I made local modifications that removed the lambda mocks from the unit tests, so that the functions were referencing the original AWS functions to ensure calls to S3 still worked as expected.

  4. Using the Unreal editor, I used the batch permutation generator functionality with a bucket name that didn't exist to test S3 bucket creation. This worked as expected.

How does this commit make you feel? (Optional, but encouraged)

Excited! This change gets us one step closer to a working CI/CD pipeline...


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.