You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The root of this module location is intended to run integration tests using the terraform test framework. The tests are located at `integration/tests`
5
4
6
-
The tests are run using the `terraform test -verbose` command from this folder `observe-agent/integration`
5
+
The tests are run using the `terraform test -verbose` command from this folder `observe-agent/integration`
7
6
8
-
When the above command is run, the tests in the `integration/tests` directory are ran using the variables provided. The tests are ran in the order of the run blocks provided in `<test>.tftest.hcl`
7
+
When the above command is run, the tests in the `integration/tests` directory are ran using the variables provided. The tests are ran in the order of the run blocks provided in `<test>.tftest.hcl`
9
8
10
9
Generally a test will do the following for any given EC2 Machine:
10
+
11
11
- Create a machine using the variables provided below in `us-west-1`
12
-
- Run a test using `observeinc/collection/aws//modules/testing/exec` module to accept python scripts located at `integration/tests/scripts`
12
+
- Run a test using `observeinc/collection/aws//modules/testing/exec` module to accept python scripts located at `integration/tests/scripts`
13
13
14
-
###Pre-requisites
14
+
## Pre-requisites
15
15
16
-
Ensure you have the following:
17
-
- Built version of the agent ( in `observe-repos/observe-agent/dist`) using `go-releaser`
16
+
Ensure you have the following:
17
+
18
+
- Built version of the agent ( in `observe-agent/dist`) using `go-releaser`
18
19
- Blunderdome Admin Access in AWS (used to assume the `gh-observe_agent-repo` role for testing )
19
-
- Observe Collection URL & Datastream Token to test with
20
-
- Generated Private & public key pair ( name to `test_key.pub` & `test_key.pem`)
20
+
- Observe Collection URL & Datastream Token to test with
21
+
- Generated Private & public key pair ( name to `test_key.pub` & `test_key.pem`)
21
22
- Terraform provider overide and terraform variables (see below section on how to do this)
If agent distributable is not built, you may get the following message:
31
31
32
-
```
32
+
```txt
33
33
│ Error: Test assertion failed
34
34
│
35
35
│ on tests/integration.tftest.hcl line 65, in run "test_install":
@@ -40,78 +40,69 @@ If agent distributable is not built, you may get the following message:
40
40
│ Error in Installation Test
41
41
```
42
42
43
-
44
-
**SSH Key Pairs**:
43
+
**SSH Key Pairs**:
45
44
46
45
Generate in PEM format for the OpenSSH Key that will be used by Terraform EC2 Modules:
47
46
48
-
```
47
+
```sh
49
48
ssh-keygen -m PEM
50
49
```
51
50
52
51
For more info on generating SSH keys, see [here](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/create-key-pairs.html#how-to-generate-your-own-key-and-import-it-to-aws)
53
52
54
-
Ensure you have `./test_key.pub` and `./test_key.pem` in the `integration` directory. This can also be changed and specifed in the `integration/tests.auto.tfvars` file.
55
-
56
-
Ensure the extensions are correct!
53
+
Ensure you have `./test_key.pub` and `./test_key.pem` in the `integration` directory. This can also be changed and specifed in the `integration/tests.auto.tfvars` file.
3. Click Switch role and input details for `nikhil-ps-account` which is the member account for integration testing within Blunderdome. Details are the following:
4. You can now access EC2 machines and download key pairs (same as what Github Actions workflow uses)
67
+
3. Click Switch role and input details for `nikhil-ps-account` which is the member account for integration testing within Blunderdome. Details are the following:
76
68
77
-
5. Ensure you're in `us-west-1`
69
+

78
70
71
+
4. You can now access EC2 machines and download key pairs (same as what Github Actions workflow uses)
79
72
73
+
5. Ensure you're in `us-west-1`
80
74
81
-
###Terraform Variables
75
+
## Terraform Variables
82
76
83
-
The tests are run using the following variables. These can be set in the `integration/tests.auto.tfvars` file for local testing.
77
+
The tests are run using the following variables. These can be set in the `integration/tests.auto.tfvars` file for local testing.
84
78
85
-
```
86
-
name_format = "tf-observe-agent-test-%s"
87
-
AWS_MACHINE= "AMAZON_LINUX_2023" #Choose the AWS Machine to run the tests on
79
+
```terraform
80
+
name_format = "tf-observe-agent-test-%s"
81
+
AWS_MACHINE= "AMAZON_LINUX_2023" #Choose the AWS Machine to run the tests on
88
82
PUBLIC_KEY_PATH = "./test_key.pub" #Path to Public Key for EC2
89
83
PRIVATE_KEY_PATH = "./test_key.pem" #Path to Private Key for EC2
90
-
OBSERVE_URL = "https://<TENANT_ID.collect.observe-staging.com>" #Observe URL to use for testing
Any of the python scripts in the `/scripts` directory can be tested by running them directly, granted an EC2 Machine exists. As the scripts rely on the outputs of `create_ec2` and `setup_observe_variables` modules to be passed in as environment variables, these environment variables can be manually set if the set up modules are not ran.
153
138
154
-
The `/scripts/<test_xyz.py` expects the following environment variables to be set:
139
+
The `/scripts/<test_xyz>.py` expects the following environment variables to be set:
155
140
156
-
```
141
+
```sh
157
142
HOST="54.177.249.99"#HOST IP Address
158
143
USER="ubuntu"#HOST user to login as
159
144
KEY_FILENAME="./test_key.pem"#Private path to key
@@ -162,19 +147,20 @@ MACHINE_CONFIG="ami_description:Ubuntu Server 22.04 LTS (HVM)- EBS General Purpo
162
147
OBSERVE_URL=""#Observe URL to use for testing
163
148
OBSERVE_TOKEN=""#Observe Token to use for testing
164
149
PASSWORD="WindowsPassword to be used for testing"# Set to None for testing
0 commit comments