3
3
[tox]
4
4
skipsdist = True
5
5
skip_missing_interpreters = True
6
+ envlist = unit, sanity, integration
6
7
7
8
[testenv]
8
9
setenv =
@@ -12,57 +13,63 @@ setenv =
12
13
CHARM_BRANCH =main
13
14
LOCAL_CHARM_DIR =charm_repo
14
15
15
- [testenv:unit ]
16
+ [testenv:pack ]
16
17
passenv = *
17
18
allowlist_externals =
18
- bash
19
- tox
20
19
rockcraft
21
- deps =
22
- juju~=2.9.0
23
- pytest
24
- pytest-operator
25
- ops
26
20
commands =
27
- # build and pack rock
28
21
rockcraft pack
22
+
23
+ [testenv:export-to-docker]
24
+ passenv = *
25
+ allowlist_externals =
26
+ bash
27
+ skopeo
28
+ yq
29
+ commands =
30
+ # pack rock and export to docker
29
31
bash -c ' NAME=$(yq eval .name rockcraft.yaml) && \
30
32
VERSION=$(yq eval .version rockcraft.yaml) && \
31
- ARCH=$(yq eval ".platforms | keys" rockcraft.yaml | awk -F " " ' \' ' { print $2 }' \' ' ) && \
32
- ROCK =" $\{NAME\}_$\{VERSION\}_$\{ARCH\}" && \
33
- sudo skopeo --insecure-policy copy oci-archive:$ROCK.rock docker-daemon:$ROCK:$VERSION && \
34
- docker save $ROCK > $ROCK.tar'
35
- # run rock tests
36
- pytest -v --tb native --show-capture=all --log-cli-level=INFO {posargs} {toxinidir}/tests
33
+ ARCH=$(yq eval ".platforms | keys | .[0]" rockcraft.yaml) && \
34
+ ROCK="$\{ NAME\} _$\{ VERSION\} _$\{ ARCH\} .rock" && \
35
+ DOCKER_IMAGE=$NAME:$VERSION && \\
36
+ echo "Exporting $ROCK to docker as $DOCKER_IMAGE" && \
37
+ skopeo --insecure-policy copy oci-archive:$ROCK docker-daemon:$DOCKER_IMAGE'
38
+
39
+ [testenv:sanity]
40
+ passenv = *
41
+ allowlist_externals =
42
+ echo
43
+ commands =
44
+ # TODO: Implement sanity tests
45
+ echo " WARNING: This is a placeholder test - no test is implemented here."
37
46
38
47
[testenv:integration]
39
48
passenv = *
40
49
allowlist_externals =
50
+ echo
41
51
bash
42
52
git
43
53
rm
44
54
tox
45
- rockcraft
46
55
deps =
47
- juju~=2.9 .0
56
+ juju<4 .0
48
57
pytest
49
58
pytest-operator
50
59
ops
51
60
commands =
52
- # build and pack rock
53
- rockcraft pack
54
- # clone related charm
55
- rm -rf {env:LOCAL_CHARM_DIR}
56
- git clone --branch {env:CHARM_BRANCH} {env:CHARM_REPO} {env:LOCAL_CHARM_DIR}
57
- # upload rock to docker and microk8s cache, replace charm' s container with local rock reference
58
- bash -c ' NAME=$(yq eval .name rockcraft.yaml) && \
59
- VERSION=$(yq eval .version rockcraft.yaml) && \
60
- ARCH=$(yq eval ".platforms | keys" rockcraft.yaml | awk -F " " ' \' ' { print $2 }' \' ' ) && \
61
- ROCK =" $\{NAME\}_$\{VERSION\}_$\{ARCH\}" && \
62
- sudo skopeo --insecure-policy copy oci-archive:$ROCK.rock docker-daemon:$ROCK:$VERSION && \
63
- docker save $ROCK > $ROCK.tar && \
64
- microk8s ctr image import $ROCK.tar && \
65
- yq e -i " .resources.oci-image.upstream-source=\" $ROCK:$VERSION\" " {env:LOCAL_CHARM_DIR}/charms/kfp-viz/metadata.yaml'
66
- # run charm integration test with rock
67
- tox -c {env:LOCAL_CHARM_DIR} -e integration
68
-
61
+ echo " WARNING: This is a placeholder test - no test is implemented here."
62
+ # Below is commented out due to https://github.com/canonical/pipelines-rocks/issues/61
63
+ # we should remove above line and uncomment the below, once this is fixed.
64
+ ; # clone related charm
65
+ ; rm -rf {env:LOCAL_CHARM_DIR}
66
+ ; git clone --branch {env:CHARM_BRANCH} {env:CHARM_REPO} {env:LOCAL_CHARM_DIR}
67
+ ; # upload rock to docker and microk8s cache, replace charm's container with local rock reference
68
+ ; bash -c 'NAME=$(yq eval .name rockcraft.yaml) && \
69
+ ; VERSION=$(yq eval .version rockcraft.yaml) && \
70
+ ; DOCKER_IMAGE=$NAME:$VERSION && \
71
+ ; docker save $DOCKER_IMAGE > $DOCKER_IMAGE.tar && \
72
+ ; sudo microk8s ctr image import $DOCKER_IMAGE.tar --digests=true && \
73
+ ; yq e -i ".resources.oci-image.upstream-source=\"$DOCKER_IMAGE\"" {env:LOCAL_CHARM_DIR}/charms/kfp-viz/metadata.yaml'
74
+ ; # run bundle integration tests with rock
75
+ ; tox -c {env:LOCAL_CHARM_DIR} -e bundle-integration-v2 -- --model kubeflow
0 commit comments