get.porter.sh/porter@v1.3.0/pkg/porter/pull_test.go (about)

     1  package porter
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/stretchr/testify/assert"
     7  	"github.com/stretchr/testify/require"
     8  )
     9  
    10  func TestBundlePullOptions_validtag(t *testing.T) {
    11  	opts := BundlePullOptions{
    12  		Reference: "deislabs/kubetest:1.0",
    13  	}
    14  
    15  	err := opts.Validate()
    16  	require.NoError(t, err, "valid tag should not produce an error")
    17  	assert.Equal(t, opts.Reference, opts.GetReference().String())
    18  }
    19  
    20  func TestBundlePullOptions_invalidtag(t *testing.T) {
    21  	opts := BundlePullOptions{
    22  		Reference: "deislabs/kubetest:1.0:ahjdljahsdj",
    23  	}
    24  
    25  	err := opts.Validate()
    26  	require.Error(t, err, "invalid tag should produce an error")
    27  }