Skip to content

Commit 26479ef

Browse files
authored
Add test for docker (#161)
1 parent 36d401e commit 26479ef

9 files changed

Lines changed: 96 additions & 27 deletions

File tree

.bazelrc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,11 @@ test:ferrocene-coverage --run_under=@score_tooling//coverage:llvm_profile_wrappe
6363
# Coverage needs to have all intermediate .rlibs to be able to proceed
6464
build:ferrocene-coverage --remote_download_all
6565

66+
# Output only failed test logs
67+
test --test_output=errors
68+
6669
test:itf-qnx-x86_64 --config=qnx-x86_64
6770
test:itf-qnx-x86_64 --run_under=@score_itf//scripts:run_under_qemu
68-
test:itf-qnx-x86_64 --test_output=errors
6971

7072
test:unit-tests --config=linux-x86_64
7173
test:unit-tests --build_tests_only

.github/workflows/build_and_test_linux.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ jobs:
3333
- name: Checkout repository
3434
uses: actions/checkout@v4.2.2
3535

36+
- name: Set up Docker Buildx
37+
uses: docker/setup-buildx-action@v3.8.0
38+
3639
- name: Setup Bazel
3740
uses: bazel-contrib/setup-bazel@0.18.0
3841
with:
@@ -47,4 +50,4 @@ jobs:
4750
4851
- name: Integration tests
4952
run: |
50-
echo "NOT YET IMPLEMENTED"
53+
bazel test --config=linux-x86_64 //feature_integration_tests/itf:linux_x86_64

MODULE.bazel

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,18 @@ toolchains_qnx.sdp(
6262
)
6363
use_repo(toolchains_qnx, "toolchains_qnx_sdp")
6464
use_repo(toolchains_qnx, "toolchains_qnx_ifs")
65+
66+
67+
bazel_dep(name = "rules_oci", version = "1.8.0")
68+
69+
oci = use_extension("@rules_oci//oci:extensions.bzl", "oci")
70+
71+
oci.pull(
72+
name = "ubuntu_22_04",
73+
digest = "sha256:3ba65aa20f86a0fad9df2b2c259c613df006b2e6d0bfcc8a146afb8c525a9751",
74+
image = "ubuntu",
75+
platforms = ["linux/amd64"],
76+
tag = "22.04",
77+
)
78+
79+
use_repo(oci, "ubuntu_22_04")

bazel_common/score_modules_tooling.MODULE.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ bazel_dep(name = "score_itf")
2525
git_override(
2626
module_name = "score_itf",
2727
remote = "https://github.com/eclipse-score/itf.git",
28-
commit = "1f4655af3daa85c03f91f584a3a9a1ea3ab54e62",
28+
commit = "e1243f3818fd78b72f79741082016fd3d7c85329",
2929
)
3030

3131
bazel_dep(name = "score_tooling")

feature_integration_tests/itf/BUILD

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
load("@score_itf//:defs.bzl", "py_itf_test")
2+
load("@score_itf//score/itf/plugins:plugins.bzl", "docker")
3+
4+
15
filegroup(
26
name = "all_tests",
37
srcs = [
@@ -8,3 +12,20 @@ filegroup(
812
"//images/qnx_x86_64:__pkg__",
913
],
1014
)
15+
16+
py_itf_test(
17+
name = "linux_x86_64",
18+
srcs = [
19+
":all_tests",
20+
],
21+
args = [
22+
"--docker-image-bootstrap=$(location //images/linux_x86_64:docker_image_tarball)",
23+
"--docker-image=score_showcases:latest",
24+
],
25+
data = [
26+
"//images/linux_x86_64:docker_image_tarball",
27+
],
28+
plugins = [
29+
docker,
30+
],
31+
)

feature_integration_tests/itf/test_showcases.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,26 +13,26 @@
1313

1414
import logging
1515

16+
1617
logger = logging.getLogger(__name__)
1718

1819

19-
def test_showcase_app_is_deployed(target):
20-
with target.ssh() as ssh:
21-
exit_code, stdout, stderr = ssh.execute_command_output("test -f /showcases/bin/ipc_bridge_cpp")
22-
assert exit_code == 0, "SSH command failed"
20+
def test_ipc_bridge_cpp_app_is_deployed(target):
21+
exit_code, out = target.execute("test -f /showcases/bin/ipc_bridge_cpp")
22+
assert exit_code == 0
2323

2424

25-
def test_showcase_app_is_running(target):
26-
with target.ssh() as ssh:
27-
exit_code, stdout, stderr = ssh.execute_command_output(
28-
"cd /showcases/data/comm; /showcases/bin/ipc_bridge_cpp -n 10 -t 100 -m send & /showcases/bin/ipc_bridge_cpp -n 5 -t 100 -m recv",
29-
timeout=30,
30-
max_exec_time=180,
31-
logger_in=logger,
32-
verbose=True,
33-
)
25+
def test_ipc_bridge_cpp_app_is_running(target):
26+
exit_code, out = target.execute(
27+
"cd /showcases/data/comm; /showcases/bin/ipc_bridge_cpp -n 10 -t 100 -m send & /showcases/bin/ipc_bridge_cpp -n 5 -t 100 -m recv"
28+
)
29+
logger.info(out)
30+
assert exit_code == 0
3431

35-
logger.info(stdout)
36-
logger.info(stderr)
3732

38-
assert exit_code == 0, "SSH command failed"
33+
def test_run_all_showcases(target):
34+
exit_code, out = target.execute(
35+
"/showcases/bin/cli --examples=all"
36+
)
37+
logger.info(out)
38+
assert exit_code == 0

feature_integration_tests/itf/test_ssh.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,11 @@
1010
#
1111
# SPDX-License-Identifier: Apache-2.0
1212
# *******************************************************************************
13-
# from itf.plugins.com.ping import ping
1413

14+
import score.itf
1515

16+
17+
@score.itf.plugins.core.requires_capabilities("ssh")
1618
def test_ssh_with_default_user(target):
1719
with target.ssh() as ssh:
1820
exit_code, stdout, stderr = ssh.execute_command_output(
@@ -26,6 +28,7 @@ def test_ssh_with_default_user(target):
2628
assert stderr == [], "Expected no error output"
2729

2830

31+
@score.itf.plugins.core.requires_capabilities("ssh")
2932
def test_ssh_with_qnx_user(target):
3033
user = "qnxuser"
3134
with target.ssh(username=user) as ssh:
@@ -38,8 +41,3 @@ def test_ssh_with_qnx_user(target):
3841
"Expected QNX kernel information not found in output"
3942
)
4043
assert stderr == [], "Expected no error output"
41-
42-
43-
# def test_ping_ok(target_fixture):
44-
# is_reachable = ping(target_fixture.sut.ip_address)
45-
# assert is_reachable, "QNX Target is not reachable via ping"

images/linux_x86_64/BUILD

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
# SPDX-License-Identifier: Apache-2.0
1212
# *******************************************************************************
1313
load("@rules_shell//shell:sh_binary.bzl", "sh_binary")
14+
load("@rules_oci//oci:defs.bzl", "oci_image", "oci_tarball")
15+
load("@rules_pkg//pkg:tar.bzl", "pkg_tar")
1416

1517
alias(
1618
name = "image",
@@ -27,4 +29,32 @@ sh_binary(
2729
data = [
2830
":image",
2931
],
30-
)
32+
)
33+
34+
pkg_tar(
35+
name = "showcases_archive",
36+
srcs = [
37+
"//showcases:showcases_all",
38+
],
39+
symlinks = {
40+
"showcases": "showcases_all",
41+
}
42+
)
43+
44+
oci_image(
45+
name = "docker_image",
46+
base = "@ubuntu_22_04",
47+
tars = [
48+
":showcases_archive",
49+
],
50+
)
51+
52+
oci_tarball(
53+
name = "docker_image_tarball",
54+
image = ":docker_image",
55+
repo_tags = ["score_showcases:latest"],
56+
visibility = [
57+
"//feature_integration_tests/itf:__pkg__",
58+
],
59+
)
60+

known_good.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@
118118
},
119119
"score_itf": {
120120
"repo": "https://github.com/eclipse-score/itf.git",
121-
"hash": "1f4655af3daa85c03f91f584a3a9a1ea3ab54e62"
121+
"hash": "e1243f3818fd78b72f79741082016fd3d7c85329"
122122
},
123123
"score_tooling": {
124124
"repo": "https://github.com/eclipse-score/tooling.git",

0 commit comments

Comments
 (0)