1
1
Fork 0
mirror of https://github.com/goreleaser/nfpm synced 2024-06-03 11:46:28 +02:00

test: acceptance tests for debian i386

This commit is contained in:
Carlos Alexandro Becker 2018-03-23 13:56:57 -03:00
parent 9f7e12ad8f
commit b4d00589a1
No known key found for this signature in database
GPG Key ID: E61E2F7DC14AB940
5 changed files with 60 additions and 3 deletions

View File

@ -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
acceptance/testdata/complex.386.yaml vendored Normal file
View File

@ -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
acceptance/testdata/deb.386.dockerfile vendored Normal file
View File

@ -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
acceptance/testdata/simple.386.yaml vendored Normal file
View File

@ -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"

View File

@ -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