Skip to content
This repository has been archived by the owner on Dec 26, 2023. It is now read-only.

Commit

Permalink
Merge pull request #86 from ergomake/definition-name-validation-test-…
Browse files Browse the repository at this point in the history
…fixes

make layerfile name definition validation tests more reliable
  • Loading branch information
vieiralucas authored Sep 13, 2023
2 parents f38547f + 7c882fb commit 9b1475e
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions internal/layerfile/layerfile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"path"
"testing"

"github.com/pkg/errors"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
Expand Down Expand Up @@ -100,7 +99,7 @@ func TestToLayers_ValidateNameOfLayerDefinitions(t *testing.T) {
},
},
},
err: errors.Wrap(ErrInvalidDefinitionName, "invalid name for a layer definition"),
err: ErrInvalidDefinitionName,
},
{
name: "Name has special character",
Expand All @@ -111,7 +110,7 @@ func TestToLayers_ValidateNameOfLayerDefinitions(t *testing.T) {
},
},
},
err: errors.Wrap(ErrInvalidDefinitionName, "invalid!"),
err: ErrInvalidDefinitionName,
},
{
name: "Valid name",
Expand All @@ -128,10 +127,10 @@ func TestToLayers_ValidateNameOfLayerDefinitions(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
_, err := tt.lf.ToLayers()
if err != nil {
assert.EqualError(t, tt.err, err.Error())
if tt.err == nil {
assert.NoError(t, err)
} else {
assert.NoError(t, tt.err)
assert.ErrorIs(t, err, tt.err)
}
})
}
Expand Down

0 comments on commit 9b1475e

Please sign in to comment.