Skip to content

Commit 54ee16f

Browse files
committed
mk-oracle: Add integration test with Oracle DB inside docker
CMK-29888 Change-Id: I19c05139db210688430cb1f7fc7aa856f166e64e
1 parent 27573d8 commit 54ee16f

5 files changed

Lines changed: 385 additions & 9 deletions

File tree

buildscripts/scripts/test-integration-agent-plugin.groovy

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ void main() {
1818

1919
def single_tests = load("${checkout_dir}/buildscripts/scripts/utils/single_tests.groovy");
2020
def versioning = load("${checkout_dir}/buildscripts/scripts/utils/versioning.groovy");
21+
def package_helper = load("${checkout_dir}/buildscripts/scripts/utils/package_helper.groovy");
2122

2223
def safe_branch_name = versioning.safe_branch_name();
2324
def branch_version = versioning.get_branch_version(checkout_dir);
@@ -61,6 +62,22 @@ void main() {
6162
|===================================================
6263
""".stripMargin());
6364

65+
def all_stages = package_helper.provide_agent_binaries(
66+
version: version,
67+
cmk_version: cmk_version,
68+
edition: edition,
69+
disable_cache: false,
70+
bisect_comment: params.CIPARAM_BISECT_COMMENT,
71+
artifacts_base_dir: "tmp_artifacts",
72+
fake_artifacts: false,
73+
);
74+
75+
inside_container_minimal(safe_branch_name: safe_branch_name) {
76+
all_stages["build-mk-oracle-rhel8"]();
77+
}
78+
79+
def mk_oracle_binary_path = "${checkout_dir}/omd/packages/mk-oracle/mk-oracle.rhel8"
80+
6481
// this is a quick fix for FIPS based tests, see CMK-20851
6582
def build_node = params.CIPARAM_OVERRIDE_BUILD_NODE;
6683
if (build_node == "fips") {
@@ -90,6 +107,7 @@ void main() {
90107
branch_name: setup_values.safe_branch_name,
91108
make_target: make_target,
92109
test_filter: params.TEST_FILTER,
110+
mk_oracle_binary_path: "--mk-oracle-binary-path=${mk_oracle_binary_path}",
93111
// can hit 5min during the heavy chain runs (without wait time)
94112
// using FoS of 3
95113
timeout: 15,

buildscripts/scripts/utils/single_tests.groovy

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ void run_make_target(Map args) {
125125
message: args.message,
126126
]) {
127127
docker.withRegistry(DOCKER_REGISTRY, "nexus") {
128+
def mk_oracle_binary_path_arg = args.mk_oracle_binary_path ? "MK_ORACLE_BINARY_PATH='${args.mk_oracle_binary_path}'" : "";
128129
// no inline bash comments are allowed in this sh call
129130
sh("""
130131
RESULT_PATH='${args.result_path}' \
@@ -141,6 +142,7 @@ void run_make_target(Map args) {
141142
CI_BUILD_URL='${env.BUILD_URL}' \
142143
OTEL_SDK_DISABLED='${env.OTEL_SDK_DISABLED}' \
143144
OTEL_EXPORTER_OTLP_ENDPOINT='${env.OTEL_EXPORTER_OTLP_ENDPOINT}' \
145+
${mk_oracle_binary_path_arg} \
144146
make ${args.make_target}
145147
""");
146148
}

tests/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,8 @@ test-integration-agent-plugin-docker:
197197

198198
test-integration-agent-plugin:
199199
$(PYTEST) -x $(realpath agent_plugin_integration) \
200-
$(PYTEST_SYSTEM_TEST_ARGS) --session-timeout 3600
200+
$(PYTEST_SYSTEM_TEST_ARGS) --session-timeout 3600 \
201+
$(MK_ORACLE_BINARY_PATH)
201202

202203
test-lint-bazel:
203204
../scripts/run-buildifier --lint=warn --mode=check

tests/agent_plugin_integration/conftest.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,20 @@
2121
logger = logging.getLogger()
2222

2323

24+
def pytest_addoption(parser: pytest.Parser) -> None:
25+
parser.addoption(
26+
"--mk-oracle-binary-path",
27+
required=True,
28+
help="Path to a pre-built mk-oracle binary.",
29+
)
30+
31+
32+
@pytest.fixture(name="mk_oracle_binary_path", scope="session")
33+
def _mk_oracle_binary_path(request: pytest.FixtureRequest) -> Path:
34+
value: str = request.config.getoption("--mk-oracle-binary-path")
35+
return Path(value)
36+
37+
2438
@pytest.fixture(name="client", scope="session")
2539
def _docker_client() -> docker.DockerClient:
2640
return docker.DockerClient()

0 commit comments

Comments
 (0)