Skip to content

Commit

Permalink
tests: add spread suite for godeps plugin
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
kyrofa committed Aug 8, 2018
1 parent 67d94bd commit 244ec19
Show file tree
Hide file tree
Showing 11 changed files with 69 additions and 72 deletions.
2 changes: 2 additions & 0 deletions spread.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,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/nil/:
summary: tests of snapcraft's Nil plugin

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 244ec19

Please sign in to comment.