@@ -19,6 +19,7 @@ type ListArtifactsCommandTestSuite struct {
1919 artifactName string
2020 artifactPath string
2121 fingerprint string
22+ repoName string
2223}
2324
2425func (suite * ListArtifactsCommandTestSuite ) SetupTest () {
@@ -40,7 +41,23 @@ func (suite *ListArtifactsCommandTestSuite) SetupTest() {
4041 var err error
4142 suite .fingerprint , err = GetSha256Digest (suite .artifactPath , fingerprintOptions , logger )
4243 require .NoError (suite .Suite .T (), err )
43- CreateArtifact (suite .flowName2 , suite .fingerprint , suite .artifactName , suite .Suite .T ())
44+ suite .repoName = "kosli/dev"
45+ SetEnvVars (map [string ]string {
46+ "GITHUB_RUN_NUMBER" : "1234" ,
47+ "GITHUB_SERVER_URL" : "https://github.com" ,
48+ "GITHUB_REPOSITORY" : suite .repoName ,
49+ "GITHUB_REPOSITORY_ID" : "1234567890" ,
50+ }, suite .Suite .T ())
51+ CreateArtifactOnTrail (suite .flowName2 , "trail-1" , "backend" , suite .fingerprint , suite .artifactName , suite .Suite .T ())
52+ }
53+
54+ func (suite * ListArtifactsCommandTestSuite ) TearDownTest () {
55+ UnSetEnvVars (map [string ]string {
56+ "GITHUB_RUN_NUMBER" : "" ,
57+ "GITHUB_SERVER_URL" : "" ,
58+ "GITHUB_REPOSITORY" : "" ,
59+ "GITHUB_REPOSITORY_ID" : "" ,
60+ }, suite .Suite .T ())
4461}
4562
4663func (suite * ListArtifactsCommandTestSuite ) TestListArtifactsCmd () {
@@ -91,6 +108,11 @@ func (suite *ListArtifactsCommandTestSuite) TestListArtifactsCmd() {
91108 cmd : fmt .Sprintf (`list artifacts --flow %s %s` , suite .flowName2 , suite .defaultKosliArguments ),
92109 goldenFile : "output/list/list-artifacts.txt" ,
93110 },
111+ {
112+ name : "listing artifacts on a repo works" ,
113+ cmd : fmt .Sprintf (`list artifacts --repo %s %s` , suite .repoName , suite .defaultKosliArguments ),
114+ goldenFile : "output/list/list-artifacts.txt" ,
115+ },
94116 }
95117
96118 runTestCmd (suite .Suite .T (), tests )
0 commit comments