Skip to content

Commit 429ba95

Browse files
author
Trong Nhan Mai
authored
chore: wrap up integration tests conversion (#782)
Signed-off-by: Trong Nhan Mai <trong.nhan.mai@oracle.com>
1 parent a5bb645 commit 429ba95

File tree

105 files changed

+5440
-552
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

105 files changed

+5440
-552
lines changed

Makefile

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -298,16 +298,38 @@ test-go:
298298
# Note: to disable npm tests set `NO_NPM` environment variable to `TRUE`.
299299
.PHONY: integration-test
300300
integration-test:
301-
scripts/dev_scripts/integration_tests.sh $(REPO_PATH) "${HOME}"
301+
if [ "${NO_NPM}" == "TRUE" ]; then \
302+
echo "Note: NO_NPM environment variable is set to TRUE, so npm tests will be skipped."; \
303+
python ./tests/integration/run.py \
304+
run \
305+
--include-tag macaron-python-package \
306+
--exclude-tag skip \
307+
--exclude-tag npm-registry-testcase \
308+
./tests/integration/cases/...; \
309+
else \
310+
python ./tests/integration/run.py \
311+
run \
312+
--include-tag macaron-python-package \
313+
--exclude-tag skip \
314+
./tests/integration/cases/...; \
315+
fi
302316

303317
.PHONY: integration-test-docker
304318
integration-test-docker:
305-
scripts/dev_scripts/integration_tests_docker.sh $(REPO_PATH) scripts/release_scripts/run_macaron.sh
319+
python ./tests/integration/run.py \
320+
run \
321+
--macaron scripts/release_scripts/run_macaron.sh \
322+
--include-tag macaron-docker-image \
323+
--exclude-tag skip \
324+
./tests/integration/cases/...
306325

307326
# Update the expected results of the integration tests after generating the actual results.
308327
.PHONY: integration-test-update
309328
integration-test-update:
310-
scripts/dev_scripts/integration_tests.sh $(REPO_PATH) "${HOME}" "--update"
329+
python ./tests/integration/run.py \
330+
update \
331+
--exclude-tag skip \
332+
./tests/integration/cases/...
311333

312334
# Build a source distribution package and a binary wheel distribution artifact.
313335
# When building these artifacts, we need the environment variable SOURCE_DATE_EPOCH

scripts/dev_scripts/integration_tests.sh

Lines changed: 0 additions & 409 deletions
This file was deleted.

scripts/dev_scripts/integration_tests_docker.sh

Lines changed: 0 additions & 69 deletions
This file was deleted.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
# Copyright (c) 2023 - 2023, Oracle and/or its affiliates. All rights reserved.
1+
# Copyright (c) 2022 - 2024, Oracle and/or its affiliates. All rights reserved.
22
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/.
File renamed without changes.

tests/e2e/__init__.py

Lines changed: 0 additions & 2 deletions
This file was deleted.

tests/e2e/configurations/jackson_databind_config.yaml

Lines changed: 0 additions & 8 deletions
This file was deleted.

tests/integration/README.md

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -133,38 +133,53 @@ $ python ./tests/integration/run.py run ./all/cases/...
133133
134134
In certain cases, we can utilize the feature of tags to select a subset of test cases to run with the `run` command.
135135
136-
Each test case can be attached with one or more tags in the yaml configuration. For example, you may find some of our test cases having the `docker` tag as follows.
136+
Each test case can be attached with one or more tags in the yaml configuration. For example, you may find some of our test cases having the tags as follows.
137137
138138
```yaml
139139
description: ...
140140
tags:
141-
- docker
141+
- macaron-python-package
142+
- macaron-docker-image
142143
steps:
143144
- ...
144145
```
145146
146-
We typically have the test cases for the container image being a subset of the test cases for the Macaron Python package. We can mark the test cases shared for both purposes with the `docker` tag. When we do integration testing for the container image, we can add the argument `--include-tag docker` to filter only test cases tagged with `docker`.
147+
We typically have test cases that are shared for the container image and the Macaron Python package. We can mark the test cases shared for both purposes with `macaron-python-package` and `macaron-docker-image` tags.
148+
When we do integration testing for the container image, we can add the argument `--include-tag macaron-docker-image` to filter test cases that are tagged with `macaron-docker-image`.
147149
148150
```bash
149-
# Test the container image with test cases having the `docker` tag.
150-
$ python ./tests/integration/run.py run --include-tag docker ./all/cases/...
151+
# Test the container image with test cases having the `macaron-docker-image` tag.
152+
$ python ./tests/integration/run.py run --include-tag macaron-docker-image ./all/cases/...
151153
```
152154
153-
The `--include-tag` flag can be specified multiple times. A selected test case must contain all tags specified with the `--include-tag` flag.
155+
We can do the same with `macaron-python-package` when we do integration tests for the Macaron Python package.
156+
157+
The `--include-tag` flag can be specified multiple times. A selected test case must be tagged with at least a tag specified with any of the `--include-tag` flags.
154158
155159
```bash
156-
# Test the container image with test cases having the `docker` tag.
160+
# Test the container image with test cases having EITHER `tag-a` for `tag-b` tag.
157161
$ python ./tests/integration/run.py run --include-tag tag-a --include-tag tag-b ./all/cases/...
158162
```
159163
160164
There is also the `--exclude-tag` flag. A selected test case must also not contain any tag specified with the `--exclude-tag` flag.
161165
162166
```bash
163-
# Only run test cases not tagged with `npm`.
164-
$ python ./tests/integration/run.py run --exclude-tag npm ./all/cases/...
167+
# Only run test cases not tagged with `npm-registry-testcase`.
168+
$ python ./tests/integration/run.py run --exclude-tag npm-registry-testcase ./all/cases/...
165169
```
166170
167-
You can simply think of each `--include-tag`/`--exclude-tag` argument as adding an additional constraint that a selected test case must satisfy".
171+
You can simply think of each `--include-tag`/`--exclude-tag` argument as adding an additional constraint that a selected test case must satisfy.
172+
173+
Instructions on how to tag a test case for our CI/CD pipeline:
174+
- If you want a test case to **only** run for the container image, use **only** `macaron-docker-image`.
175+
- If you want a test case to **only** run with the Macaron Python package, use **only** `macaron-python-package`.
176+
- To skip a test case, use `skip`. `skip` still has the same effect if it's used with other tags.
177+
- If you want to run a test case for both the Macaron Python package and the docker container, use `macaron-python-package` and `macaron-docker-image` tags.
178+
- If you want to run test cases that must contain all of a given set of tags (e.g. `['tag-a', 'tag-b']`), please create an additional tag for those test cases (e.g `tag-a-b`) and use it within `--include-tag`.
179+
- Test cases marked with `npm-registry-testcase` are not run if the environment variable `NO_NPM` is set to `TRUE`. This only applies when you run the integration tests with:
180+
```bash
181+
$ make integration-test
182+
```
168183
169184
### Debug utility script
170185

tests/integration/cases/all_checks_excluded/test.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
description: |
55
Running the analysis with all checks excluded. This test should return an error code.
66
7+
tags:
8+
- macaron-python-package
9+
710
steps:
811
- name: Run macaron analyze
912
kind: analyze
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Copyright (c) 2024 - 2024, Oracle and/or its affiliates. All rights reserved.
2+
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/.
3+
4+
description: |
5+
Analyzing dependencies when neither the repository nor SBOM is available. We expect the analysis to finish with no errors.
6+
7+
tags:
8+
- macaron-python-package
9+
10+
steps:
11+
- name: Run macaron analyze
12+
kind: analyze
13+
options:
14+
command_args:
15+
- -purl
16+
- pkg:maven/private.apache.maven/maven@4.0.0-alpha-1-SNAPSHOT?type=pom

0 commit comments

Comments
 (0)