Add Sanity Check for Windows Integration Test
Description of the issue
Based on the stackoverflow, Sanity check is
sanity test is just a casual term to mean that you're testing/confirming/validating something that should follow very clear and simple logic.
Applying to our agents, sanity check is confirming both CloudWatch Agent and ADOT Collector Agent are running independently and side-by-side as expected before our integration test. However, as part of moving agent to Github Repository Epic and we releases the external agent before internal, we could not know if our agent are still independent as usual and running as expected after each PR is merged.
Therefore, I propose to add a Sanity Check for Windows before running our integration test.
Description of Changes
By utilizing the existing Terraform IAC for Windows Integration Test, I add these changes:
- Automatically add IAM Instance Profile instead of manually creating IAM Instance Profile which shares the same policies as the README.doc
- Automatically add ssh_key instead of relying on manual key which developers can utilize to avoid creating one and also reduce the environment variables for us to maintain during our integration test.
- Added a GoLang function to run PowerShell Script with these flags: NoProfile, NoExit, NonInteractive. For more information on these flags, you can read it here in the following doc
- Run Sanity Check before coming to our integration test
- Add how to run integration test on Windows, delete Security Groups for Windows in README.doc since we are not using
winrmas a connection type and Terraform does not recommended us to use WinRM (only as a last resolution). Moreover, I also propose to delete Security Groups Ingress since the resources are created within the VPC.
License
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Tests
After introduces the changes, I run the below command
terraform apply -auto-approve github_repo={{my forked repo}} github_sha={{my commited sha in my forked repo}} s3_bucket={{my s3 bucket}}
which gives me the follow result
null_resource.integration_test: Still creating... [1m30s elapsed]
null_resource.integration_test: Still creating... [1m40s elapsed]
null_resource.integration_test: Still creating... [1m50s elapsed]
null_resource.integration_test: Still creating... [2m0s elapsed]
null_resource.integration_test (remote-exec): === RUN TestAgentStatus
null_resource.integration_test: Still creating... [2m10s elapsed]
null_resource.integration_test: Still creating... [2m20s elapsed]
null_resource.integration_test: Still creating... [2m30s elapsed]
null_resource.integration_test: Still creating... [2m40s elapsed]
null_resource.integration_test: Still creating... [2m50s elapsed]
null_resource.integration_test (remote-exec): --- PASS: TestAgentStatus (44.84s)
null_resource.integration_test (remote-exec): PASS
null_resource.integration_test (remote-exec): ok github.com/aws/amazon-cloudwatch-agent/integration/test/sanity 45.203s
null_resource.integration_test: Creation complete after 2m52s [id=8591283884920986776]
and running terraform destroy afterwards to destroy the resources which are created by terraform on my account.
Note
- The Build Check is unrelated to this change and because we have known how flakey it is
Requirements
Before commit the code, please do the following steps.
- Run
make fmtandmake fmt-sh - Run
make linter
Codecov Report
Merging #478 (b16af7b) into master (3083957) will not change coverage. The diff coverage is
n/a.
@@ Coverage Diff @@
## master #478 +/- ##
=======================================
Coverage 56.85% 56.85%
=======================================
Files 374 374
Lines 17744 17744
=======================================
Hits 10089 10089
Misses 7064 7064
Partials 591 591
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.
This PR was marked stale due to lack of activity.
This PR was marked stale due to lack of activity.
This PR was marked stale due to lack of activity.
@khanhntd there are merge conflicts with the main branch
@khanhntd there are merge conflicts with the main branch
Yup I'm testing the port so will merge it after the test.