Skip to content

Commit

Permalink
tests: add spread suite for godeps plugin (#2200)
Browse files Browse the repository at this point in the history
Move the plugin integration tests for the Godeps plugin into a Spread
suite.

LP: #1783833

Signed-off-by: Kyle Fazzari <kyrofa@ubuntu.com>
  • Loading branch information
Kyle Fazzari authored and sergiusens committed Aug 10, 2018
1 parent 19c651a commit 84932cc
Show file tree
Hide file tree
Showing 12 changed files with 75 additions and 75 deletions.
9 changes: 6 additions & 3 deletions debian/tests/integrationtests-spread
Original file line number Diff line number Diff line change
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

# 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
Original file line number Diff line number Diff line change
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/meson/:
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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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" ]
Original file line number Diff line number Diff line change
@@ -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
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 84932cc

Please sign in to comment.