mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-02-03 13:11:48 +02:00
test: make gometalinter happy
Fix strange things gometalinter complains about and which break the CI build.
This commit is contained in:
parent
1f0d44d576
commit
523a650f4f
@ -52,7 +52,6 @@ func TestSignArtifacts(t *testing.T) {
|
|||||||
desc string
|
desc string
|
||||||
ctx *context.Context
|
ctx *context.Context
|
||||||
signatures []string
|
signatures []string
|
||||||
artifacts []string
|
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
desc: "sign all artifacts",
|
desc: "sign all artifacts",
|
||||||
@ -102,8 +101,8 @@ func testSign(t *testing.T, ctx *context.Context, signatures []string) {
|
|||||||
artifacts := ctx.Artifacts
|
artifacts := ctx.Artifacts
|
||||||
for _, f := range artifacts {
|
for _, f := range artifacts {
|
||||||
file := filepath.Join(tmpdir, f)
|
file := filepath.Join(tmpdir, f)
|
||||||
if err := ioutil.WriteFile(file, []byte("foo"), 0644); err != nil {
|
if err2 := ioutil.WriteFile(file, []byte("foo"), 0644); err2 != nil {
|
||||||
t.Fatal("WriteFile: ", err)
|
t.Fatal("WriteFile: ", err2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -138,6 +137,14 @@ func testSign(t *testing.T, ctx *context.Context, signatures []string) {
|
|||||||
|
|
||||||
// verify the signatures
|
// verify the signatures
|
||||||
for _, sig := range signatures {
|
for _, sig := range signatures {
|
||||||
|
verifySignature(t, ctx, sig)
|
||||||
|
}
|
||||||
|
|
||||||
|
// check signature is an artifact
|
||||||
|
assert.Equal(t, ctx.Artifacts, append(artifacts, signatures...))
|
||||||
|
}
|
||||||
|
|
||||||
|
func verifySignature(t *testing.T, ctx *context.Context, sig string) {
|
||||||
artifact := sig[:len(sig)-len(".sig")]
|
artifact := sig[:len(sig)-len(".sig")]
|
||||||
|
|
||||||
// verify signature was made with key for usesr 'nopass'
|
// verify signature was made with key for usesr 'nopass'
|
||||||
@ -155,8 +162,4 @@ func testSign(t *testing.T, ctx *context.Context, signatures []string) {
|
|||||||
if !bytes.Contains(out, []byte(user)) {
|
if !bytes.Contains(out, []byte(user)) {
|
||||||
t.Fatalf("signature is not from %s", user)
|
t.Fatalf("signature is not from %s", user)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// check signature is an artifact
|
|
||||||
assert.Equal(t, ctx.Artifacts, append(artifacts, signatures...))
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user