Skip to content

Commit 1b9fe61

Browse files
author
Nicholas Thomson
committed
Fix workflow and update test structure
1 parent 4fe1404 commit 1b9fe61

File tree

6 files changed

+22
-36
lines changed

6 files changed

+22
-36
lines changed

.github/workflows/e2e-test.yaml

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,6 @@ on:
1111
description: 'Git ref for checking out the community repo. Default is main'
1212
required: false
1313
default: ''
14-
codeGeneratorRepo:
15-
description: 'Git repository for checking out the code-generator repo'
16-
required: false
17-
default: 'aws-controllers-k8s/code-generator'
18-
codeGeneratorRef:
19-
description: 'Git ref for checking out the code-generator repo. Default is main'
20-
required: false
21-
default: ''
2214
testInfraRepo:
2315
description: 'Git repository for checking out the test-infra repo'
2416
required: false
@@ -56,27 +48,13 @@ jobs:
5648
ref: ${{ github.event.inputs.communityRef }}
5749
path: './src/github.com/aws-controllers-k8s/community'
5850

59-
- name: checkout code-generator
60-
uses: actions/checkout@v2
61-
with:
62-
repository: ${{ github.event.inputs.codeGeneratorRepo }}
63-
ref: ${{ github.event.inputs.codeGeneratorRef }}
64-
path: './src/github.com/aws-controllers-k8s/code-generator'
65-
6651
- name: checkout test-infra
6752
uses: actions/checkout@v2
6853
with:
6954
repository: ${{ github.event.inputs.testInfraRepo }}
7055
ref: ${{ github.event.inputs.testInfraRef }}
7156
path: './src/github.com/aws-controllers-k8s/test-infra'
7257

73-
- name: build controller
74-
working-directory: './src/github.com/aws-controllers-k8s/community'
75-
run: ./scripts/build-controller.sh $SERVICE
76-
env:
77-
SERVICE: ${{ matrix.service }}
78-
GOPATH: ${{ github.workspace }}
79-
8058
- name: execute e2e tests
8159
working-directory: './src/github.com/aws-controllers-k8s/community'
8260
run: |

test/e2e/__init__.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,11 @@
1212
# permissions and limitations under the License.
1313

1414
import pytest
15+
from typing import Dict, Any
1516
from pathlib import Path
17+
1618
from acktest.k8s import resource
19+
from acktest.resources import load_resource_file
1720

1821
SERVICE_NAME = "s3"
1922
CRD_GROUP = "s3.services.k8s.aws"
@@ -22,7 +25,13 @@
2225
# PyTest marker for the current service
2326
service_marker = pytest.mark.service(arg=SERVICE_NAME)
2427

28+
bootstrap_directory = Path(__file__).parent
2529
resource_directory = Path(__file__).parent / "resources"
30+
def load_s3_resource(resource_name: str, additional_replacements: Dict[str, Any] = {}):
31+
""" Overrides the default `load_resource_file` to access the specific resources
32+
directory for the current service.
33+
"""
34+
return load_resource_file(resource_directory, resource_name, additional_replacements=additional_replacements)
2635

2736
def create_s3_resource(
2837
resource_plural, resource_name, spec_file, replacements, namespace="default"
@@ -32,7 +41,7 @@ def create_s3_resource(
3241
"""
3342

3443
reference, spec, resource = resource.load_and_create_resource(
35-
SERVICE_NAME,
44+
resource_directory,
3645
CRD_GROUP,
3746
CRD_VERSION,
3847
resource_plural,

test/e2e/bootstrap_resources.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,19 @@
1515
"""
1616
from dataclasses import dataclass
1717

18+
from e2e import bootstrap_directory
1819
from acktest.resources import read_bootstrap_config
19-
from e2e import SERVICE_NAME
2020

2121
@dataclass
2222
class TestBootstrapResources:
2323
pass
2424

2525
_bootstrap_resources = None
2626

27-
def get_bootstrap_resources():
27+
def get_bootstrap_resources(bootstrap_file_name: str = "bootstrap.yaml"):
2828
global _bootstrap_resources
2929
if _bootstrap_resources is None:
30-
_bootstrap_resources = TestBootstrapResources(**read_bootstrap_config(SERVICE_NAME))
30+
_bootstrap_resources = TestBootstrapResources(
31+
**read_bootstrap_config(bootstrap_directory, bootstrap_file_name=bootstrap_file_name),
32+
)
3133
return _bootstrap_resources

test/e2e/requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
acktest @ git+https://github.com/aws-controllers-k8s/test-infra.git@f9216390ff69b7defe2925dd65990364b37636f7
1+
acktest @ git+https://github.com/aws-controllers-k8s/test-infra.git@6c6d9dd4759c7bb2feecd11dc03e8516371812cc
22
apipkg==1.5
33
attrs==20.3.0
44
boto3==1.16.40
@@ -23,7 +23,7 @@ pytest==6.2.3
2323
pytest-forked==1.3.0
2424
pytest-xdist==2.2.0
2525
python-dateutil==2.8.1
26-
PyYAML==5.4
26+
PyYAML==5.3.1
2727
requests==2.25.1
2828
requests-oauthlib==1.3.0
2929
rsa==4.7.2

test/e2e/service_bootstrap.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
from pathlib import Path
1818

1919
from acktest import resources
20+
from e2e import bootstrap_directory
2021
from e2e.bootstrap_resources import TestBootstrapResources
2122

2223

@@ -27,8 +28,5 @@ def service_bootstrap() -> dict:
2728
).__dict__
2829

2930
if __name__ == "__main__":
30-
root_test_path = Path(__file__).parent
31-
3231
config = service_bootstrap()
33-
# Write config to current directory by default
34-
resources.write_bootstrap_config(config, root_test_path)
32+
resources.write_bootstrap_config(config, bootstrap_directory)

test/e2e/service_cleanup.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
from pathlib import Path
1818

1919
from acktest import resources
20+
from e2e import bootstrap_directory
2021
from e2e.bootstrap_resources import TestBootstrapResources
2122

2223
def service_cleanup(config: dict):
@@ -26,8 +27,6 @@ def service_cleanup(config: dict):
2627
**config
2728
)
2829

29-
if __name__ == "__main__":
30-
root_test_path = Path(__file__).parent
31-
32-
bootstrap_config = resources.read_bootstrap_config(root_test_path)
30+
if __name__ == "__main__":
31+
bootstrap_config = resources.read_bootstrap_config(bootstrap_directory)
3332
service_cleanup(bootstrap_config)

0 commit comments

Comments
 (0)