Skip to content

Commit

Permalink
add e2e test docs
Browse files Browse the repository at this point in the history
  • Loading branch information
PatrickKoss committed Aug 25, 2023
1 parent 3fbac60 commit 6871391
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ html-coverage: out/report.json
out/report.json:
go test -race ./... -coverprofile=out/cover.out --json | tee "$(@)"

test-e2e:
@STACKIT_TOKEN=$(STACKIT_TOKEN) TEST_ZONE_NAME=$(TEST_ZONE_NAME) go test -race -tags=e2e ./... -coverprofile out/cover.out

run:
go run cmd/main.go

Expand Down
49 changes: 49 additions & 0 deletions e2e_test/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# End-to-End (E2E) Test Suite

This repository segment encapsulates the comprehensive E2E testing procedures for this project module. It harnesses the `fixture.RunConformance` method to execute conformity verification sequences, ensuring adherence to `cert-manager` established protocols.

## Test Execution Workflow

### Environmental Prerequisite Configuration:
For appropriate test initialization within the STACKIT ecosystem, it is imperative to align the environment with
the predetermined specifications. STACKIT dictates a structural model where a parent project umbrellas various
resource entities, inclusive of DNS zones.

1. **Project Identification Parameterization**:
Configure the unique `project_id` in the [configuration manifest](../testdata/stackit/config.json). Typical configuration appears as:
```json
{
"projectId": "c242332a-ae82-42e2-80e8-eed338fd2b2f",
"authTokenSecretNamespace": "default"
}
```

This instantiation assumes the existence of the specified project, and the associated authentication
token possesses requisite privileges for project and zone access.
2. **Authentication Token Configuration**:
Establish an environment variable for the authentication token, duly vested with CRUD permissions for DNS zones:
```bash
export STACKIT_TOKEN="<your-token>"
```
3. **Zone Initialization**:
Declare the testing DNS zone. Ensure project_id consistency:
```bash
export TEST_ZONE_NAME="test-zone.runs.onstackit.cloud"
```
Invoke the following HTTP request to either instantiate a fresh zone or validate the existing one:
```bash
curl --location "https://dns.api.stackit.cloud/v1/projects/c242332a-ae82-42e2-80e8-eed338fd2b2f/zones" \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer $AUTHENTICATION_TOKEN" \
--data '{
"name": "cert manager e2e test",
"dnsName": "$TEST_ZONE_NAME"
}'
```
Post successful invocation, validate zone ownership. For pre-existing zones, consider a unique zone parameter.

### Environmental Prerequisite Configuration:
With prerequisites addressed, proceed to run the entire E2E test suite:
```bash
make test-e2e
```

0 comments on commit 6871391

Please sign in to comment.