Skip to content

Commit

Permalink
fix: fix harness tests with intoto v0.0.2 (#1052)
Browse files Browse the repository at this point in the history
Signed-off-by: Asra Ali <asraa@google.com>
  • Loading branch information
asraa committed Sep 14, 2022
1 parent e7dc6c5 commit e0853da
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/harness_test.go
Expand Up @@ -246,7 +246,12 @@ func compareAttestation(t *testing.T, logIndex int, got string) {

// Make sure we can get and verify all entries
// For attestations, make sure we can see the attestation
// Older versions of the CLI may not be able to parse the retrieved entry.
func TestHarnessGetAllEntriesLogIndex(t *testing.T) {
if rekorCLIIncompatible() {
t.Skipf("Skipping getting entries by UUID, old rekor-cli version %s is incompatible with server version %s", os.Getenv("CLI_VERSION"), os.Getenv("SERVER_VERSION"))
}

treeSize := activeTreeSize(t)
if treeSize == 0 {
t.Fatal("There are 0 entries in the log, there should be at least 2")
Expand Down Expand Up @@ -331,11 +336,15 @@ func activeTreeSize(t *testing.T) int {

// Check if we have a new server version and an old CLI version
// since the new server returns an EntryID but the old CLI version expects a UUID
// Also, new rekor server allows upload of intoto v0.0.2, and old rekor cli versions
// don't understand how to parse these entries.
// TODO: use semver comparisons.
func rekorCLIIncompatible() bool {
if sv := os.Getenv("SERVER_VERSION"); sv != "v0.10.0" && sv != "v0.11.0" {
if cv := os.Getenv("CLI_VERSION"); cv == "v0.10.0" || cv == "v0.11.0" {
return true
}
}

return false
}

0 comments on commit e0853da

Please sign in to comment.