Skip to content

Commit

Permalink
test: acceptance tests for debian i386
Browse files Browse the repository at this point in the history
  • Loading branch information
caarlos0 committed Mar 23, 2018
1 parent 9f7e12a commit b4d0058
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 3 deletions.
14 changes: 12 additions & 2 deletions acceptance/deb_acceptance_test.go
Expand Up @@ -3,9 +3,19 @@ package acceptance
import "testing"

func TestSimpleDeb(t *testing.T) {
accept(t, "simple_deb", "simple.yaml", "deb", "deb.dockerfile")
t.Run("amd64", func(t *testing.T) {
accept(t, "simple_deb", "simple.yaml", "deb", "deb.dockerfile")
})
t.Run("i386", func(t *testing.T) {
accept(t, "simple_deb_386", "simple.386.yaml", "deb", "deb.386.dockerfile")
})
}

func TestComplexDeb(t *testing.T) {
accept(t, "complex_deb", "complex.yaml", "deb", "deb.dockerfile")
t.Run("amd64", func(t *testing.T) {
accept(t, "complex_deb", "complex.yaml", "deb", "deb.dockerfile")
})
t.Run("i386", func(t *testing.T) {
accept(t, "complex_deb_386", "complex.386.yaml", "deb", "deb.dockerfile")
})
}
23 changes: 23 additions & 0 deletions acceptance/testdata/complex.386.yaml
@@ -0,0 +1,23 @@
name: "foo"
arch: "386"
platform: "linux"
version: "v1.2.3"
maintainer: "Foo Bar"
depends:
- bash
provides:
- fake
replaces:
- foo
suggests:
- zsh
description: |
Foo bar
Multiple lines
vendor: "foobar"
homepage: "https://foobar.org"
license: "MIT"
files:
../testdata/fake: "/usr/local/bin/fake"
config_files:
../testdata/whatever.conf: "/etc/foo/whatever.conf"
10 changes: 10 additions & 0 deletions acceptance/testdata/deb.386.dockerfile
@@ -0,0 +1,10 @@
FROM i386/ubuntu
ARG package
COPY ${package} /tmp/foo.deb
RUN dpkg -i /tmp/foo.deb && \
test -e /usr/local/bin/fake && \
test -f /etc/foo/whatever.conf && \
echo wat >> /etc/foo/whatever.conf && \
dpkg -r foo && \
test -f /etc/foo/whatever.conf && \
test ! -f /usr/local/bin/fake
15 changes: 15 additions & 0 deletions acceptance/testdata/simple.386.yaml
@@ -0,0 +1,15 @@
name: "foo"
arch: "386"
platform: "linux"
version: "v1.2.3"
maintainer: "Foo Bar"
description: |
Foo bar
Multiple lines
vendor: "foobar"
homepage: "https://foobar.org"
license: "MIT"
files:
../testdata/fake: "/usr/local/bin/fake"
config_files:
../testdata/whatever.conf: "/etc/foo/whatever.conf"
1 change: 0 additions & 1 deletion deb/deb.go
Expand Up @@ -41,7 +41,6 @@ type Deb struct{}

// Package writes a new deb package to the given writer using the given info
func (*Deb) Package(info nfpm.Info, deb io.Writer) (err error) {
// TODO: add acceptance tests for this
arch, ok := goarchToDebian[info.Arch]
if ok {
info.Arch = arch
Expand Down

0 comments on commit b4d0058

Please sign in to comment.