File: e2e

package info (click to toggle)
golang-github-notaryproject-notation 1.2.0-4
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 2,160 kB
  • sloc: sh: 202; makefile: 67
file content (78 lines) | stat: -rw-r--r-- 2,325 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/bin/bash

set -eux

set -o pipefail

if ! groups | grep -q docker; then
    echo "User $(whoami) is not in 'docker' group. Fixing permissions..."
    # make docker work as user
    sudo adduser $(whoami) docker
    exec newgrp -c "$0" docker
fi

dh_auto_configure -O--buildsystem=golang -O--builddirectory=_build


# avoid accessing internet but use debian sources for gomodules
export GO111MODULE=off
export GOPATH="${PWD}/_build:/usr/share/gocode:${PWD}/test/e2e/plugin:${PWD}/test/e2e"
export GOCACHE="${PWD}/_build/go-build"
export GOPROXY="off"
export BUILDTAGS=""


# github.com/notaryproject/notation/test/e2e

# NB: taken from tests/e2e/run.sh

# these are being picked up by the e2e test suite
# setting to the same value defeats backward-compatibility testing
export NOTATION_E2E_BINARY_PATH=/usr/bin/notation
export NOTATION_E2E_OLD_BINARY_PATH=$NOTATION_E2E_BINARY_PATH


# build e2e plugin and tar.gz
PLUGIN_NAME=notation-e2e-plugin
#( cd ${PWD}/plugin && go build -o ./bin/$PLUGIN_NAME . && echo "e2e plugin built." && tar -czvf ./bin/$PLUGIN_NAME.tar.gz -C ./bin/ $PLUGIN_NAME )

DH_GOPKG=github.com/notaryproject/notation/test/e2e/plugin  \
  dh_auto_build -O--buildsystem=golang -O--builddirectory=_build


mkdir -p _build/${PLUGIN_NAME}/bin
mv -v _build/bin/plugin _build/bin/${PLUGIN_NAME}
tar -czvf _build/${PLUGIN_NAME}.tar.gz -C _build/bin/ $PLUGIN_NAME

# setup registry
cd test/e2e
set +u
source ./scripts/zot.sh

setup_registry

# defer cleanup registry
function cleanup {
    set +u
    cleanup_registry
}
trap cleanup EXIT

cd $OLDPWD

set -u
# set environment variable for E2E testing
export NOTATION_E2E_CONFIG_PATH=${PWD}/test/e2e/testdata/config
export NOTATION_E2E_OCI_LAYOUT_PATH=${PWD}/test/e2e/testdata/registry/oci_layout
export NOTATION_E2E_TEST_REPO=e2e
export NOTATION_E2E_TEST_TAG=v1
export NOTATION_E2E_PLUGIN_PATH=${PWD}/_build/bin/${PLUGIN_NAME}
export NOTATION_E2E_PLUGIN_TAR_GZ_PATH=${PWD}/_build/${PLUGIN_NAME}.tar.gz
export NOTATION_E2E_MALICIOUS_PLUGIN_ARCHIVE_PATH=${PWD}/test/e2e/testdata/malicious-plugin

DH_GOPKG=github.com/notaryproject/notation/test/e2e  \
  dh_auto_build -O--buildsystem=golang -O--builddirectory=_build

# run tests
DH_GOPKG=github.com/notaryproject/notation/test/e2e \
  dh_auto_test -O--buildsystem=golang -O--builddirectory=_build --no-parallel