github.com/olli-ai/jx/v2@v2.0.400-0.20210921045218-14731b4dd448/pkg/cmd/step/step_wait_for_artifact_test.go (about)

     1  // +build unit
     2  
     3  package step_test
     4  
     5  import (
     6  	"testing"
     7  
     8  	"github.com/olli-ai/jx/v2/pkg/cmd/step"
     9  
    10  	"github.com/stretchr/testify/assert"
    11  )
    12  
    13  func TestStepWaitForArtifact(t *testing.T) {
    14  	t.Parallel()
    15  	options := &step.StepWaitForArtifactOptions{
    16  		RepoURL:    step.DefaultMavenCentralRepo,
    17  		GroupId:    "io.jenkins.updatebot",
    18  		ArtifactId: "updatebot-core",
    19  		Version:    "1.1.10",
    20  		Extension:  "pom",
    21  	}
    22  
    23  	err := options.Run()
    24  	assert.NoError(t, err)
    25  
    26  	options = &step.StepWaitForArtifactOptions{
    27  		RepoURL:    step.DefaultMavenCentralRepo,
    28  		GroupId:    "io.jenkins.updatebot",
    29  		ArtifactId: "does-not-exist",
    30  		Version:    "1.1.10",
    31  		Extension:  "pom",
    32  		Timeout:    "1s",
    33  		PollTime:   "100ms",
    34  	}
    35  
    36  	err = options.Run()
    37  	assert.Errorf(t, err, "Should have failed to find the artifact")
    38  }