...

Source file src/github.com/sigstore/rekor/pkg/pki/tuf/e2e_test.go

Documentation: github.com/sigstore/rekor/pkg/pki/tuf

     1  //
     2  // Copyright 2022 The Sigstore Authors.
     3  //
     4  // Licensed under the Apache License, Version 2.0 (the "License");
     5  // you may not use this file except in compliance with the License.
     6  // You may obtain a copy of the License at
     7  //
     8  //     http://www.apache.org/licenses/LICENSE-2.0
     9  //
    10  // Unless required by applicable law or agreed to in writing, software
    11  // distributed under the License is distributed on an "AS IS" BASIS,
    12  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  // See the License for the specific language governing permissions and
    14  // limitations under the License.
    15  
    16  //go:build e2e
    17  // +build e2e
    18  
    19  package tuf
    20  
    21  import (
    22  	"github.com/sigstore/rekor/pkg/util"
    23  	"path/filepath"
    24  	"testing"
    25  )
    26  
    27  func TestTufVerifyUpload(t *testing.T) {
    28  	artifactPath := filepath.Join(t.TempDir(), "timestamp.json")
    29  	rootPath := filepath.Join(t.TempDir(), "root.json")
    30  
    31  	createTufSignedArtifact(t, artifactPath, rootPath)
    32  
    33  	// Now upload to rekor!
    34  	out := util.RunCli(t, "upload", "--artifact", artifactPath, "--public-key", rootPath, "--type", "tuf")
    35  	util.OutputContains(t, out, "Created entry at")
    36  
    37  	uuid := util.GetUUIDFromUploadOutput(t, out)
    38  
    39  	out = util.RunCli(t, "verify", "--artifact", artifactPath, "--public-key", rootPath, "--type", "tuf")
    40  	util.OutputContains(t, out, "Inclusion Proof")
    41  
    42  	out = util.RunCli(t, "search", "--public-key", rootPath, "--pki-format", "tuf")
    43  	util.OutputContains(t, out, uuid)
    44  }
    45  

View as plain text