From 13c0c1e59e6ad3cd4cab8eb9853aa50cb3769f5f Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Thu, 3 Feb 2022 10:46:04 +0100 Subject: [PATCH] test: Add skopeo tests There is a source test that installs a pre-build, embeded image file and ensure all the right files are installed. This uses the vfs driver because then it works everywhere, including the CI (which doesn't do overlayfs). Then the is a source test that downloads a minimal image from a faked registry on localhost. For the registy API to work the "/v2" entry-point in the webserver has to be at the root, so there is a symlink in test/data: v2 -> sources/org.osbuild.skopeo/data/v2 But otherwise the data is localized to sources/org.osbuild.skopeo. --- .../org.osbuild.skopeo/cases/empty.json | 6 + .../cases/invalid_digest.json | 14 + .../cases/missing_image.json | 14 + .../org.osbuild.skopeo/cases/success.json | 14 + ...aafe0d9e9b4c548b8909b14ffb032aa20fa23d9ad6 | 1 + ...14bb32320c6b34518ff6f1445a5c23e036e55391c7 | Bin 0 -> 134 bytes ...fdc201ec3546c4cf1887fb45f8d3198dde7a39b3f4 | 1 + ...546c4cf1887fb45f8d3198dde7a39b3f4.mimetype | 1 + test/data/stages/skopeo/a.json | 736 ++++++++++++++++++ test/data/stages/skopeo/a.mpp.json | 69 ++ test/data/stages/skopeo/b.json | 683 ++++++++++++++++ test/data/stages/skopeo/b.mpp.json | 21 + test/data/stages/skopeo/diff.json | 31 + test/data/stages/skopeo/hello.img | Bin 0 -> 9216 bytes test/data/v2 | 1 + 15 files changed, 1592 insertions(+) create mode 100644 test/data/sources/org.osbuild.skopeo/cases/empty.json create mode 100644 test/data/sources/org.osbuild.skopeo/cases/invalid_digest.json create mode 100644 test/data/sources/org.osbuild.skopeo/cases/missing_image.json create mode 100644 test/data/sources/org.osbuild.skopeo/cases/success.json create mode 100644 test/data/sources/org.osbuild.skopeo/data/v2/osbuild/hello/blobs/sha256:805e972fbc4dfa74a616dcaafe0d9e9b4c548b8909b14ffb032aa20fa23d9ad6 create mode 100644 test/data/sources/org.osbuild.skopeo/data/v2/osbuild/hello/blobs/sha256:e2f43980f5c62d8424c6fd14bb32320c6b34518ff6f1445a5c23e036e55391c7 create mode 100644 test/data/sources/org.osbuild.skopeo/data/v2/osbuild/hello/manifests/sha256:a606d2a723b78633e33932fdc201ec3546c4cf1887fb45f8d3198dde7a39b3f4 create mode 100644 test/data/sources/org.osbuild.skopeo/data/v2/osbuild/hello/manifests/sha256:a606d2a723b78633e33932fdc201ec3546c4cf1887fb45f8d3198dde7a39b3f4.mimetype create mode 100644 test/data/stages/skopeo/a.json create mode 100644 test/data/stages/skopeo/a.mpp.json create mode 100644 test/data/stages/skopeo/b.json create mode 100644 test/data/stages/skopeo/b.mpp.json create mode 100644 test/data/stages/skopeo/diff.json create mode 100644 test/data/stages/skopeo/hello.img create mode 120000 test/data/v2 diff --git a/test/data/sources/org.osbuild.skopeo/cases/empty.json b/test/data/sources/org.osbuild.skopeo/cases/empty.json new file mode 100644 index 00000000..d6533773 --- /dev/null +++ b/test/data/sources/org.osbuild.skopeo/cases/empty.json @@ -0,0 +1,6 @@ +{ + "expects": "success", + "org.osbuild.skopeo": { + "items": {} + } +} diff --git a/test/data/sources/org.osbuild.skopeo/cases/invalid_digest.json b/test/data/sources/org.osbuild.skopeo/cases/invalid_digest.json new file mode 100644 index 00000000..ca052570 --- /dev/null +++ b/test/data/sources/org.osbuild.skopeo/cases/invalid_digest.json @@ -0,0 +1,14 @@ +{ + "expects": "error", + "org.osbuild.skopeo": { + "items": { + "sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa": { + "image": { + "name": "localhost/osbuild/hello", + "digest": "sha256:a606d2a723b78633e33932fdc201ec3546c4cf1887fb45f8d3198dde7a39b3f4", + "tls-verify": false + } + } + } + } +} diff --git a/test/data/sources/org.osbuild.skopeo/cases/missing_image.json b/test/data/sources/org.osbuild.skopeo/cases/missing_image.json new file mode 100644 index 00000000..de942f26 --- /dev/null +++ b/test/data/sources/org.osbuild.skopeo/cases/missing_image.json @@ -0,0 +1,14 @@ +{ + "expects": "error", + "org.osbuild.skopeo": { + "items": { + "sha256:805e972fbc4dfa74a616dcaafe0d9e9b4c548b8909b14ffb032aa20fa23d9ad6": { + "image": { + "name": "localhost/osbuild/wrong", + "digest": "sha256:a606d2a723b78633e33932fdc201ec3546c4cf1887fb45f8d3198dde7a39b3f4", + "tls-verify": false + } + } + } + } +} diff --git a/test/data/sources/org.osbuild.skopeo/cases/success.json b/test/data/sources/org.osbuild.skopeo/cases/success.json new file mode 100644 index 00000000..c821babf --- /dev/null +++ b/test/data/sources/org.osbuild.skopeo/cases/success.json @@ -0,0 +1,14 @@ +{ + "expects": "success", + "org.osbuild.skopeo": { + "items": { + "sha256:805e972fbc4dfa74a616dcaafe0d9e9b4c548b8909b14ffb032aa20fa23d9ad6": { + "image": { + "name": "localhost/osbuild/hello", + "digest": "sha256:a606d2a723b78633e33932fdc201ec3546c4cf1887fb45f8d3198dde7a39b3f4", + "tls-verify": false + } + } + } + } +} diff --git a/test/data/sources/org.osbuild.skopeo/data/v2/osbuild/hello/blobs/sha256:805e972fbc4dfa74a616dcaafe0d9e9b4c548b8909b14ffb032aa20fa23d9ad6 b/test/data/sources/org.osbuild.skopeo/data/v2/osbuild/hello/blobs/sha256:805e972fbc4dfa74a616dcaafe0d9e9b4c548b8909b14ffb032aa20fa23d9ad6 new file mode 100644 index 00000000..284635f3 --- /dev/null +++ b/test/data/sources/org.osbuild.skopeo/data/v2/osbuild/hello/blobs/sha256:805e972fbc4dfa74a616dcaafe0d9e9b4c548b8909b14ffb032aa20fa23d9ad6 @@ -0,0 +1 @@ +{"created":"2022-02-02T09:04:02.049496094Z","architecture":"amd64","os":"linux","config":{"Env":["PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"],"Labels":{"io.buildah.version":"1.23.1"}},"rootfs":{"type":"layers","diff_ids":["sha256:0da97f9fb353a8d6285145bc7a1b75a28652e80f60ab7479bf5b4ae67ffa37e8"]},"history":[{"created":"2022-02-02T09:04:02.050044248Z","created_by":"/bin/sh -c #(nop) COPY file:ac7ec5eb9477808d410f8800080ebdc3aaa81212a142cb9002e7eb4ae8610cd0 in / "}]} \ No newline at end of file diff --git a/test/data/sources/org.osbuild.skopeo/data/v2/osbuild/hello/blobs/sha256:e2f43980f5c62d8424c6fd14bb32320c6b34518ff6f1445a5c23e036e55391c7 b/test/data/sources/org.osbuild.skopeo/data/v2/osbuild/hello/blobs/sha256:e2f43980f5c62d8424c6fd14bb32320c6b34518ff6f1445a5c23e036e55391c7 new file mode 100644 index 0000000000000000000000000000000000000000..ffa5e8dc448791e9dd604322c836867b16612aa8 GIT binary patch literal 134 zcmV;10D1o(iwFP!32ul0|K!mz3d1lA1yIdBg?oYW<*N1-dW}L09Sj1;Avt~s85}$$ zlOdqD2=qZ9>HkYfA7w7o4;TnR2%EM7{2~^PK?H&)fqnFz9O{UE#-V&N0a^9%24{J* o)IPeh_xgV~X-?n!t+tIb&N$3|J(OT@*aX!x$wEy8OxNkoJfW#(?%$)1ye+FMw|rCL1{rnu07LK zIWD|cnQ$`gRXZCf5DKMq7XL%}@Soml+w>FQg3b~cnD-#v%Pv|Fv>I8W=ArD28#&#v zhA&)IHEI8@|BMR)2H^ao{s+KphA9@DQlOB{024vTk^SE`&0Y+K`ZwiqvS`agNw zw3Yq-yU(}>rl}_cCIlt~CIr4L1SBw*3*xn*)+<33$J`pFyaSuNTvNlS)G~)$W9q$z zj3`CGE0WnIz!84yg5e*X{HFxVY64`pk}p!^piutKJF zs&^I@hyWpvApTAvFMt+6QlL4_Ipp+jbb?fC7G>{DzieHQSFbInp}FZor7G*?yHGJr z?aNoFSfMBN8&teR&wn|6`ty9*wezYms+xDYtczRqUG=78-L$EOPjq&IepA|2VVM;w zn^Z5$%Bn^B#goi=Jk75q`^$@{Wu-2IT+qyx-k+B?^u0vgLJ`Ib z7|DLnSy*vVc74-chG_@EWHAs3l@ZKq+|P9wiRQu1dACR&ndFBb>*nI8i+LMF09|HvUV*h>Sa}}6U$A*`Bt^-_WS3rwlV*@_I#H&ZYC(#x$nq4 z=>0VKu1xE2F?-0FUaPwFuIul^;~u(hjO~5*Ke>4uj-uiH7Ymr;|DkYy(zw7`9$zyy zbda}z5C|{aMRTfNMWVH)ZfpJ(NY^29`M|i&KFPpIcrOBN@Ksj^{#v?jui%Kzq4*Ds m_5J%FV@}z0|BrzD-a}Vk&sBAAnLfeC?O1pWhx