testdriverai 6.1.7 → 6.1.8-canary.5d001de.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -15,28 +15,37 @@ Self-hosting TestDriver allows you to run tests on your own infrastructure, givi
|
|
|
15
15
|
|
|
16
16
|
## Why self host?
|
|
17
17
|
|
|
18
|
+
Self-hosting TestDriver gives you complete control over your test execution environment:
|
|
19
|
+
|
|
18
20
|
- **Enhanced security**: Get complete control over ingress and egress rules.
|
|
19
|
-
- **Complete customization**: Modify the TestDriver Golden Image to include custom dependencies, software, and configurations at launch time.
|
|
21
|
+
- **Complete customization**: Modify the TestDriver Golden Image (our pre-configured AMI) to include custom dependencies, software, and configurations at launch time.
|
|
20
22
|
- **Powerful Infrastructure**: Run tests on bare metal infrastructure that support emulators and simulators.
|
|
21
23
|
|
|
24
|
+
You'll use the [TestDriver CLI repository](https://github.com/testdriverai/cli) which contains all the infrastructure templates and setup scripts needed for self-hosting.
|
|
25
|
+
|
|
22
26
|
## Overview
|
|
23
27
|
|
|
24
|
-
|
|
28
|
+
By the end of this guide, you'll have a complete self-hosted testing infrastructure that can:
|
|
29
|
+
|
|
30
|
+
- Spawn TestDriver instances on-demand in your AWS account
|
|
31
|
+
- Run tests on your own AWS infrastructure with custom configurations
|
|
32
|
+
- Integrate seamlessly with GitHub Actions CI/CD workflows
|
|
33
|
+
- Automatically clean up resources after test completion
|
|
25
34
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
35
|
+
The setup process involves three main steps:
|
|
36
|
+
|
|
37
|
+
1. **CloudFormation Infrastructure**: Deploy our `setup/aws/cloudformation.yaml` template to create the foundational AWS resources (VPC, security groups, IAM roles, and a launch template for instance creation).
|
|
38
|
+
2. **On-Demand Instance Spawning**: Use `setup/aws/spawn-runner.sh` with your Launch Template ID to programmatically spawn TestDriver instances whenever you need to run tests.
|
|
39
|
+
3. **GitHub Actions Integration**: Use `.github/workflows/self-hosted.yml` as a template for running tests in CI. This workflow demonstrates the complete lifecycle: spawning an instance, running tests, and shutting down the instance to minimize costs.
|
|
30
40
|
|
|
31
41
|
## Prerequisites
|
|
32
42
|
|
|
33
43
|
- AWS account with permissions to run CloudFormation.
|
|
34
44
|
- [AWS CLI](https://aws.amazon.com/cli/) installed locally.
|
|
35
45
|
|
|
36
|
-
<Tip>
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
- Access to the TestDriver AMI\
|
|
46
|
+
<Tip>Be sure to run `aws configure` with your credentials</Tip>
|
|
47
|
+
|
|
48
|
+
- Access to the TestDriver AMI (Golden Image)\
|
|
40
49
|
[Contact us with your preferred AWS Region for access](https://form.typeform.com/to/UECf9rDx?typeform-source=testdriver.ai).
|
|
41
50
|
- A GitHub repository for committing your tests & workflow.
|
|
42
51
|
|
|
@@ -57,7 +66,7 @@ This is a one-time setup used to generate a template ID for launching instances.
|
|
|
57
66
|
# Deploy the CloudFormation stack
|
|
58
67
|
aws cloudformation deploy \
|
|
59
68
|
--template-file setup/aws/cloudformation.yaml \
|
|
60
|
-
--stack-name testdriver-infrastructure
|
|
69
|
+
--stack-name my-testdriver-infrastructure \
|
|
61
70
|
--parameter-overrides \
|
|
62
71
|
ProjectTag=testdriver \
|
|
63
72
|
AllowedIngressCidr=0.0.0.0/0 \
|
|
@@ -67,7 +76,8 @@ aws cloudformation deploy \
|
|
|
67
76
|
```
|
|
68
77
|
|
|
69
78
|
<Danger>
|
|
70
|
-
**Security**: Replace `AllowedIngressCidr=0.0.0.0/0` with your specific IP
|
|
79
|
+
**Security**: Replace `AllowedIngressCidr=0.0.0.0/0` with your specific IP
|
|
80
|
+
ranges to lock down access to your VPC.
|
|
71
81
|
</Danger>
|
|
72
82
|
|
|
73
83
|
### Get Launch Template ID
|
|
@@ -76,32 +86,35 @@ After CloudFormation completes, find the launch template ID in the stack outputs
|
|
|
76
86
|
|
|
77
87
|
```bash
|
|
78
88
|
aws cloudformation describe-stacks \
|
|
79
|
-
--stack-name testdriver-infrastructure
|
|
89
|
+
--stack-name my-testdriver-infrastructure \
|
|
80
90
|
--query 'Stacks[0].Outputs[?OutputKey==`LaunchTemplateId`].OutputValue' \
|
|
81
91
|
--output text
|
|
82
92
|
```
|
|
83
93
|
|
|
84
|
-
<Tip>
|
|
85
|
-
**Save this ID** – you'll need it for the next step.
|
|
86
|
-
</Tip>
|
|
94
|
+
<Tip>**Save this ID** – you'll need it for the next step.</Tip>
|
|
87
95
|
|
|
88
96
|
## Step 2: Spawn a New TestDriver Runner
|
|
89
97
|
|
|
90
|
-
|
|
98
|
+
This step is performed **every time you want to run tests**. The `spawn-runner.sh` script launches a new EC2 instance on-demand for test execution.
|
|
91
99
|
|
|
92
|
-
|
|
100
|
+
### Using spawn-runner.sh
|
|
93
101
|
|
|
94
|
-
-
|
|
95
|
-
|
|
96
|
-
-
|
|
102
|
+
Our [`setup/aws/spawn-runner.sh`](https://github.com/testdriverai/cli/tree/main/setup/aws/spawn-runner.sh) script:
|
|
103
|
+
|
|
104
|
+
- Launches a new EC2 instance using your launch template from Step 1
|
|
105
|
+
- Waits for the instance to become ready
|
|
106
|
+
- Completes the TestDriver handshake
|
|
107
|
+
- Returns instance details (IP, instance ID) for CLI usage
|
|
108
|
+
|
|
109
|
+
The script accepts parameters as either environment variables or CLI arguments:
|
|
97
110
|
|
|
98
111
|
```bash
|
|
99
|
-
# Launch an instance
|
|
112
|
+
# Launch an instance using environment variables
|
|
100
113
|
export AWS_REGION=us-east-2
|
|
101
114
|
export AMI_ID=ami-•••••••••• # Your TestDriver AMI (contact us to get one)
|
|
102
115
|
export AWS_LAUNCH_TEMPLATE_ID=lt-•••••••••• # From CloudFormation output from step 1
|
|
103
116
|
|
|
104
|
-
/bin/bash ./setup/aws/
|
|
117
|
+
/bin/bash ./setup/aws/spawn-runner.sh
|
|
105
118
|
```
|
|
106
119
|
|
|
107
120
|
The script outputs:
|
|
@@ -112,6 +125,13 @@ INSTANCE_ID=i-1234567890abcdef0
|
|
|
112
125
|
AWS_REGION=us-east-2
|
|
113
126
|
```
|
|
114
127
|
|
|
128
|
+
<Note>
|
|
129
|
+
**Instance Lifecycle**: Instances spawned by this script will continue running
|
|
130
|
+
until you manually terminate them. They are automatically tagged with
|
|
131
|
+
`Name=TestDriverRunner` and `Project=[your ProjectTag value]` for easy
|
|
132
|
+
identification in the AWS console.
|
|
133
|
+
</Note>
|
|
134
|
+
|
|
115
135
|
### CLI Usage
|
|
116
136
|
|
|
117
137
|
Once you have an instance IP, run tests directly:
|
|
@@ -128,17 +148,26 @@ npx testdriverai@latest run testdriver/your-test.yaml \
|
|
|
128
148
|
--ip="$PUBLIC_IP" \
|
|
129
149
|
```
|
|
130
150
|
|
|
131
|
-
|
|
151
|
+
### Terminating Instances
|
|
152
|
+
|
|
153
|
+
After your tests complete, terminate the instance to avoid unnecessary costs:
|
|
132
154
|
|
|
133
155
|
```bash
|
|
134
|
-
|
|
156
|
+
# Terminate the instance
|
|
157
|
+
aws ec2 terminate-instances --instance-ids $INSTANCE_ID --region $AWS_REGION
|
|
135
158
|
```
|
|
136
159
|
|
|
160
|
+
You can also terminate instances manually through the AWS console by searching for instances tagged with `Name=TestDriverRunner`.
|
|
161
|
+
|
|
137
162
|
## Step 3: GitHub Actions Integration
|
|
138
163
|
|
|
164
|
+
This step shows you how to automate the entire test lifecycle in CI/CD.
|
|
165
|
+
|
|
139
166
|
### Example Workflow
|
|
140
167
|
|
|
141
|
-
Our [`.github/workflows/self-hosted.yml`](https://github.com/testdriverai/cli/tree/main/.github/workflows/self-hosted.yml) demonstrates the complete workflow:
|
|
168
|
+
Our [`.github/workflows/self-hosted.yml`](https://github.com/testdriverai/cli/tree/main/.github/workflows/self-hosted.yml) demonstrates the complete workflow: spawning an EC2 instance, running your tests, and shutting down the instance automatically to minimize costs.
|
|
169
|
+
|
|
170
|
+
The workflow uses the GitHub secrets you configure (see below) to authenticate with AWS and spawn instances on-demand:
|
|
142
171
|
|
|
143
172
|
```yaml
|
|
144
173
|
name: TestDriver Self-Hosted
|
|
@@ -205,11 +234,24 @@ Configure these secrets in your GitHub repository:
|
|
|
205
234
|
|
|
206
235
|
### Using the Base AMI
|
|
207
236
|
|
|
208
|
-
Our AMI comes pre-configured with:
|
|
237
|
+
Our TestDriver Golden Image (AMI) comes pre-configured with everything you need to run tests:
|
|
238
|
+
|
|
239
|
+
**Operating System & Environment:**
|
|
209
240
|
|
|
210
241
|
- Windows Server with desktop environment
|
|
211
|
-
-
|
|
242
|
+
- VNC + web server for remote desktop access through the browser
|
|
243
|
+
|
|
244
|
+
**Development Tools:**
|
|
245
|
+
|
|
246
|
+
- Python (with pip)
|
|
247
|
+
- Node.js (with npm)
|
|
248
|
+
- Git
|
|
249
|
+
|
|
250
|
+
**Test Infrastructure:**
|
|
251
|
+
|
|
252
|
+
- TestDriver agent and dependencies
|
|
212
253
|
- Optimized settings for test execution
|
|
254
|
+
- Pre-configured networking for TestDriver CLI communication
|
|
213
255
|
|
|
214
256
|
### Modifying the AMI
|
|
215
257
|
|
|
@@ -281,11 +323,13 @@ steps:
|
|
|
281
323
|
|
|
282
324
|
### Common Issues
|
|
283
325
|
|
|
284
|
-
**Instance not responding:**
|
|
326
|
+
**Instance not responding in TestDriver CLI:**
|
|
327
|
+
|
|
328
|
+
When the CLI displays connection errors or timeouts, check:
|
|
285
329
|
|
|
286
|
-
-
|
|
287
|
-
-
|
|
288
|
-
-
|
|
330
|
+
- **Security group rules**: The CloudFormation template configures all necessary ports (RDP 3389, VNC 5900, and TestDriver communication ports). Verify your security group hasn't been modified.
|
|
331
|
+
- **Instance status checks**: Ensure the instance has passed both system and instance status checks in the AWS console.
|
|
332
|
+
- **AMI compatibility**: Verify the AMI is compatible with your selected instance type (some instance types don't support certain AMIs).
|
|
289
333
|
|
|
290
334
|
**Connection timeouts:**
|
|
291
335
|
|
|
@@ -305,4 +349,4 @@ For enterprise customers:
|
|
|
305
349
|
|
|
306
350
|
- Contact your account manager for AMI access issues
|
|
307
351
|
- Use support channels for infrastructure questions
|
|
308
|
-
- Check the TestDriver documentation for CLI usage
|
|
352
|
+
- Check the TestDriver documentation for CLI usage
|