|
1 | 1 | package main
|
2 | 2 |
|
3 | 3 | import (
|
| 4 | + "bytes" |
4 | 5 | "context"
|
5 | 6 | "errors"
|
6 | 7 | "fmt"
|
@@ -487,7 +488,7 @@ func Test_runVerifyGHAArtifactPath(t *testing.T) {
|
487 | 488 | // Avoid rate limiting by not running the tests in parallel.
|
488 | 489 | // t.Parallel()
|
489 | 490 |
|
490 |
| - checkVersions := getBuildersAndVersions(t, tt.minversion, tt.builders, GHA_ARTIFACT_PATH_BUILDERS) |
| 491 | + checkVersions := getBuildersAndVersions(t, "v1.2.2", tt.builders, GHA_ARTIFACT_PATH_BUILDERS) |
491 | 492 | if tt.noversion {
|
492 | 493 | checkVersions = []string{""}
|
493 | 494 | }
|
@@ -576,6 +577,37 @@ func Test_runVerifyGHAArtifactPath(t *testing.T) {
|
576 | 577 | if err := outBuilderID.Matches(*bid, false); err != nil {
|
577 | 578 | t.Errorf(fmt.Sprintf("matches failed (2): %v", err))
|
578 | 579 | }
|
| 580 | + |
| 581 | + // Smoke test against the CLI command |
| 582 | + cliCmd := verifyArtifactCmd() |
| 583 | + args := []string{ |
| 584 | + artifactPath, |
| 585 | + "--source-uri", tt.source, |
| 586 | + "--provenance-path", provenancePath} |
| 587 | + if bid != nil { |
| 588 | + args = append(args, "--builder-id", *bid) |
| 589 | + } |
| 590 | + if tt.pbranch != nil { |
| 591 | + args = append(args, "--source-branch", *tt.pbranch) |
| 592 | + } |
| 593 | + if tt.ptag != nil { |
| 594 | + args = append(args, "--source-tag", *tt.ptag) |
| 595 | + } |
| 596 | + if tt.pversiontag != nil { |
| 597 | + args = append(args, "--source-versioned-tag", *tt.pversiontag) |
| 598 | + } |
| 599 | + if tt.inputs != nil { |
| 600 | + for k, v := range tt.inputs { |
| 601 | + args = append(args, "--build-workflow-input", fmt.Sprintf("%s=%s", k, v)) |
| 602 | + } |
| 603 | + } |
| 604 | + b := bytes.NewBufferString("") |
| 605 | + cliCmd.SetOut(b) |
| 606 | + cliCmd.SetArgs(args) |
| 607 | + cliErr := cliCmd.Execute() |
| 608 | + if !errCmp(cliErr, tt.err) { |
| 609 | + t.Errorf("%v: %v", v, cmp.Diff(cliErr, tt.err, cmpopts.EquateErrors())) |
| 610 | + } |
579 | 611 | }
|
580 | 612 | }
|
581 | 613 | })
|
|
0 commit comments