Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: add spread suite for godeps plugin #2200

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 6 additions & 3 deletions debian/tests/integrationtests-spread
Expand Up @@ -31,12 +31,15 @@ systemctl reload sshd.service
# Spread will only build with recent go
snap install --classic go

# and now run spread against localhost
# shellcheck disable=SC1091
. /etc/os-release
export GOPATH=/tmp/go
/snap/bin/go get -u github.com/snapcore/spread/cmd/spread

# Remove the go snap since we want to test (among other things) the Go plugin
sudo snap remove go
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we will need to fix this later in a different form, but good call on uninstalling every unneeded bit to ensure we have a self sustainable system in place.


# and now run spread against localhost
# shellcheck disable=SC1091
. /etc/os-release
export SNAPCRAFT_PACKAGE_TYPE="deb"
/tmp/go/bin/spread -v "autopkgtest:${ID}-${VERSION_ID}-$(dpkg --print-architecture)"

Expand Down
2 changes: 2 additions & 0 deletions spread.yaml
Expand Up @@ -184,6 +184,8 @@ suites:
summary: tests of snapcraft's CMake plugin
tests/spread/plugins/go/:
summary: tests of snapcraft's Go plugin
tests/spread/plugins/godeps/:
summary: tests of snapcraft's Godeps plugin
tests/spread/plugins/kbuild/:
summary: tests of snapcraft's Kbuild plugin
tests/spread/plugins/nil/:
Expand Down
68 changes: 0 additions & 68 deletions tests/integration/plugins/test_godeps_plugin.py

This file was deleted.

27 changes: 27 additions & 0 deletions tests/spread/plugins/godeps/run-with-go-packages/task.yaml
@@ -0,0 +1,27 @@
summary: Build and run a Godeps snap using go-packages

environment:
SNAP_DIR: ../snaps/godeps-with-go-packages
GOBIN/gobin: gobin
GOBIN/no_gobin:

restore: |
cd "$SNAP_DIR"
snapcraft clean
rm -f ./*.snap

execute: |
if [ -z "$GOBIN" ]; then
unset GOBIN
fi

cd "$SNAP_DIR"
snapcraft
sudo snap install godeps-with-go-packages_*.snap --dangerous

# Verify that bcrypt was not built
[ ! -e "prime/bin/bcrypt" ]

hash="$(godeps-with-go-packages.bcrypt hash 10 password)"
check="$(godeps-with-go-packages.bcrypt check "$hash" password)"
[ "$check" = "Equal" ]
24 changes: 24 additions & 0 deletions tests/spread/plugins/godeps/run/task.yaml
@@ -0,0 +1,24 @@
summary: Build and run a basic Godeps snap

environment:
SNAP_DIR: ../snaps/godeps
GOBIN/gobin: gobin
GOBIN/no_gobin:

restore: |
cd "$SNAP_DIR"
snapcraft clean
rm -f ./*.snap

execute: |
if [ -z "$GOBIN" ]; then
unset GOBIN
fi

cd "$SNAP_DIR"
snapcraft
sudo snap install godeps_*.snap --dangerous

hash="$(godeps.bcrypt hash 10 password)"
check="$(godeps.bcrypt check "$hash" password)"
[ "$check" = "Equal" ]
@@ -1,11 +1,17 @@
name: test-godeps-with-go-packages
version: 0.1
name: godeps-with-go-packages
version: '1.0'
summary: A simple godeps project which targets a specific go package.
description: |
By unsing go-packages this we ensure that only `only-main` gets built
while the bcrypt in the source does not

grade: devel
confinement: strict

apps:
bcrypt:
command: only-main

parts:
simple-godeps:
plugin: godeps
Expand Down
@@ -1,10 +1,16 @@
name: test-package
version: 0.1
name: godeps
version: '1.0'
summary: A simple godeps project.
description: |
Proves that it is possible to build a snap using godeps.

grade: devel
confinement: strict

apps:
bcrypt:
command: bcrypt

parts:
simple-godeps:
plugin: godeps
Expand Down