Skip to content

Commit

Permalink
Merge pull request #3477 from crazy-max/test-azblob-cache
Browse files Browse the repository at this point in the history
integration: basic azblob cache test
  • Loading branch information
crazy-max committed Feb 1, 2023
2 parents eefe206 + 2f8b5e7 commit dab9215
Show file tree
Hide file tree
Showing 10 changed files with 130 additions and 233 deletions.
23 changes: 0 additions & 23 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -184,29 +184,6 @@ jobs:
SKIP_INTEGRATION_TESTS: ${{ matrix.skip-integration-tests }}
CACHE_FROM: type=gha,scope=${{ env.CACHE_GHA_SCOPE_IT }} type=gha,scope=${{ env.CACHE_GHA_SCOPE_BINARIES }}

test-azblob:
runs-on: ubuntu-20.04
needs:
- base
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Expose GitHub Runtime
uses: crazy-max/ghaction-github-runtime@v2
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
version: ${{ env.BUILDX_VERSION }}
driver-opts: image=${{ env.REPO_SLUG_ORIGIN }}
buildkitd-flags: --debug
-
name: Test
run: |
hack/azblob_test/run_test.sh
test-os:
runs-on: ${{ matrix.os }}
strategy:
Expand Down
10 changes: 7 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ ARG DNSNAME_VERSION=v1.3.1
ARG NYDUS_VERSION=v2.1.0
ARG MINIO_VERSION=RELEASE.2022-05-03T20-36-08Z
ARG MINIO_MC_VERSION=RELEASE.2022-05-04T06-07-55Z
ARG AZURITE_VERSION=3.18.0

ARG ALPINE_VERSION=3.17

Expand Down Expand Up @@ -228,16 +229,19 @@ COPY --link --from=dnsname /usr/bin/dnsname /opt/cni/bin/

FROM buildkit-base AS integration-tests-base
ENV BUILDKIT_INTEGRATION_ROOTLESS_IDPAIR="1000:1000"
ARG NERDCTL_VERSION
RUN apk add --no-cache shadow shadow-uidmap sudo vim iptables ip6tables dnsmasq fuse curl git-daemon \
&& useradd --create-home --home-dir /home/user --uid 1000 -s /bin/sh user \
&& echo "XDG_RUNTIME_DIR=/run/user/1000; export XDG_RUNTIME_DIR" >> /home/user/.profile \
&& mkdir -m 0700 -p /run/user/1000 \
&& chown -R user /run/user/1000 /home/user \
&& ln -s /sbin/iptables-legacy /usr/bin/iptables \
&& xx-go --wrap \
&& curl -Ls https://raw.githubusercontent.com/containerd/nerdctl/$NERDCTL_VERSION/extras/rootless/containerd-rootless.sh > /usr/bin/containerd-rootless.sh \
&& xx-go --wrap
ARG NERDCTL_VERSION
RUN curl -Ls https://raw.githubusercontent.com/containerd/nerdctl/$NERDCTL_VERSION/extras/rootless/containerd-rootless.sh > /usr/bin/containerd-rootless.sh \
&& chmod 0755 /usr/bin/containerd-rootless.sh
ARG AZURITE_VERSION
RUN apk add --no-cache nodejs npm \
&& npm install -g azurite@${AZURITE_VERSION}
# The entrypoint script is needed for enabling nested cgroup v2 (https://github.com/moby/buildkit/issues/3265#issuecomment-1309631736)
RUN curl -Ls https://raw.githubusercontent.com/moby/moby/v20.10.21/hack/dind > /docker-entrypoint.sh \
&& chmod 0755 /docker-entrypoint.sh
Expand Down
34 changes: 34 additions & 0 deletions client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ func TestIntegration(t *testing.T) {
testBasicRegistryCacheImportExport,
testBasicLocalCacheImportExport,
testBasicS3CacheImportExport,
testBasicAzblobCacheImportExport,
testCachedMounts,
testCopyFromEmptyImage,
testProxyEnv,
Expand Down Expand Up @@ -4725,6 +4726,39 @@ func testBasicS3CacheImportExport(t *testing.T, sb integration.Sandbox) {
testBasicCacheImportExport(t, sb, []CacheOptionsEntry{im}, []CacheOptionsEntry{ex})
}

func testBasicAzblobCacheImportExport(t *testing.T, sb integration.Sandbox) {
integration.CheckFeatureCompat(t, sb, integration.FeatureCacheExport)

opts := integration.AzuriteOpts{
AccountName: "azblobcacheaccount",
AccountKey: base64.StdEncoding.EncodeToString([]byte("azblobcacheaccountkey")),
}

azAddr, cleanup, err := integration.NewAzuriteServer(t, sb, opts)
require.NoError(t, err)
defer cleanup()

im := CacheOptionsEntry{
Type: "azblob",
Attrs: map[string]string{
"account_url": azAddr,
"account_name": opts.AccountName,
"secret_access_key": opts.AccountKey,
"container": "cachecontainer",
},
}
ex := CacheOptionsEntry{
Type: "azblob",
Attrs: map[string]string{
"account_url": azAddr,
"account_name": opts.AccountName,
"secret_access_key": opts.AccountKey,
"container": "cachecontainer",
},
}
testBasicCacheImportExport(t, sb, []CacheOptionsEntry{im}, []CacheOptionsEntry{ex})
}

func testBasicInlineCacheImportExport(t *testing.T, sb integration.Sandbox) {
integration.CheckFeatureCompat(t, sb, integration.FeatureDirectPush, integration.FeatureCacheImport)
requiresLinux(t)
Expand Down
16 changes: 0 additions & 16 deletions hack/azblob_test/Dockerfile

This file was deleted.

11 changes: 0 additions & 11 deletions hack/azblob_test/docker-bake.hcl

This file was deleted.

24 changes: 0 additions & 24 deletions hack/azblob_test/run_test.sh

This file was deleted.

140 changes: 0 additions & 140 deletions hack/azblob_test/test.sh

This file was deleted.

7 changes: 0 additions & 7 deletions hack/azblob_test/test1/Dockerfile

This file was deleted.

9 changes: 0 additions & 9 deletions hack/azblob_test/test2/Dockerfile

This file was deleted.

Loading

0 comments on commit dab9215

Please sign in to comment.