Skip to content

Commit ece4cc9

Browse files
committed
Use role for integration test
1 parent 623125d commit ece4cc9

File tree

3 files changed

+21
-11
lines changed

3 files changed

+21
-11
lines changed
Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,22 @@
1-
name: integration-test
1+
name: integration
22
on:
33
push:
44
branches:
55
- main
6-
pull_request:
7-
branches:
8-
- main
9-
106
jobs:
117
integration-test:
12-
name: Run Integration- Test
8+
name: Run Integration Test
139
runs-on: ubuntu-latest
1410
environment: Integration Test
11+
permissions:
12+
id-token: write
1513
steps:
1614
- name: Configure AWS credentials
17-
uses: aws-actions/configure-aws-credentials@v1
15+
uses: aws-actions/configure-aws-credentials@master
1816
with:
19-
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
20-
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
2117
aws-region: us-west-2
18+
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
19+
role-session-name: IntegrationTestSession
2220
- name: Checkout code
2321
uses: actions/checkout@v2
2422
- name: Set up Go
@@ -34,4 +32,4 @@ jobs:
3432
- name: Run tests
3533
run: make integration-run
3634
- name: Clean up clusters
37-
run: make integration-cleanup
35+
run: make integration-cleanup

Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,11 @@ test-setup: # setup test environment
6363
test -f ${ENVTEST_ASSETS_DIR}/setup-envtest.sh || curl -sSLo ${ENVTEST_ASSETS_DIR}/setup-envtest.sh https://raw.githubusercontent.com/kubernetes-sigs/controller-runtime/v0.7.2/hack/setup-envtest.sh
6464
source ${ENVTEST_ASSETS_DIR}/setup-envtest.sh; fetch_envtest_tools $(ENVTEST_ASSETS_DIR)
6565

66+
integration-suite: ## Provision and run integration tests with cleanup
67+
make integration-setup && \
68+
make integration-run && \
69+
make integration-cleanup
70+
6671
integration-setup: build kind test-setup ## Setup the integration test using kind clusters
6772
@./integration/scripts/setup-kind.sh
6873

README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
[![CodeQL](https://github.com/aws/aws-cloud-map-mcs-controller-for-k8s/actions/workflows/codeql-analysis.yml/badge.svg?branch=main)](https://github.com/aws/aws-cloud-map-mcs-controller-for-k8s/actions/workflows/codeql-analysis.yml)
55
[![Build status](https://github.com/aws/aws-cloud-map-mcs-controller-for-k8s/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/aws/aws-cloud-map-mcs-controller-for-k8s/actions/workflows/build.yml)
66
[![Deploy status](https://github.com/aws/aws-cloud-map-mcs-controller-for-k8s/actions/workflows/deploy.yml/badge.svg?branch=main)](https://github.com/aws/aws-cloud-map-mcs-controller-for-k8s/actions/workflows/deploy.yml)
7+
[![Integration status](https://github.com/aws/aws-cloud-map-mcs-controller-for-k8s/actions/workflows/integration-test.yml/badge.svg?branch=main)](https://github.com/aws/aws-cloud-map-mcs-controller-for-k8s/actions/workflows/integration-test.yml)
78
[![codecov](https://codecov.io/gh/aws/aws-cloud-map-mcs-controller-for-k8s/branch/main/graph/badge.svg)](https://codecov.io/gh/aws/aws-cloud-map-mcs-controller-for-k8s)
89

910
[![License](https://img.shields.io/badge/license-Apache--2.0-blue.svg?color=success)](http://www.apache.org/licenses/LICENSE-2.0)
@@ -60,7 +61,7 @@ kubectl apply -f https://raw.githubusercontent.com/aws/aws-cloud-map-mcs-control
6061

6162
### Import services
6263

63-
In your other cluster, the controller will automatically sync services registered in AWS CloudMap by applying the appropriate `ServiceImport`. To list them all, run
64+
In your other cluster, the controller will automatically sync services registered in AWS Cloud Map by applying the appropriate `ServiceImport`. To list them all, run
6465
```sh
6566
kubectl get ServiceImport -A
6667
```
@@ -93,6 +94,12 @@ To install from `latest` tag run
9394
kubectl apply -k "github.com/aws/aws-cloud-map-mcs-controller-for-k8s/config/controller_install_latest"
9495
```
9596

97+
## Integration testing
98+
The end-to-end integration test suite can be run locally to validate controller core functionality. This will provision a local Kind cluster and build and run the AWS Cloud Map MCS Controller for K8s. The test will verify service endpoints sync with AWS Cloud Map. If successful, the suite will then de-provision the local test cluster and delete AWS Cloud Map namespace `aws-cloud-map-mcs-e2e` along with test service and service instance resources.
99+
```sh
100+
make integration-suite
101+
```
102+
96103
## Contributing
97104
`aws-cloud-map-mcs-controller-for-k8s` is an open source project. See [CONTRIBUTING](https://github.com/aws/aws-cloud-map-mcs-controller-for-k8s/blob/main/CONTRIBUTING.md) for details.
98105

0 commit comments

Comments
 (0)