Skip to content

Commit

Permalink
move testutils under an ./internal/ directory
Browse files Browse the repository at this point in the history
This prevents these libraries from being depended on from outside the
module.

Signed-off-by: Mike Danese <mike.danese@databricks.com>
  • Loading branch information
mikedanese committed Feb 6, 2024
1 parent 3a2b819 commit a1b3a1f
Show file tree
Hide file tree
Showing 30 changed files with 12 additions and 12 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 4 additions & 4 deletions metadata/metadata_api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ import (
"github.com/sigstore/sigstore/pkg/cryptoutils"
"github.com/sigstore/sigstore/pkg/signature"
"github.com/stretchr/testify/assert"
"github.com/theupdateframework/go-tuf/v2/testutils/testutils"
"github.com/theupdateframework/go-tuf/v2/internal/testutils"
)

func TestMain(m *testing.M) {

repoPath := "../testutils/repository_data/repository/metadata"
targetsPath := "../testutils/repository_data/repository/targets"
keystorePath := "../testutils/repository_data/keystore"
repoPath := "../internal/testutils/repository_data/repository/metadata"
targetsPath := "../internal/testutils/repository_data/repository/targets"
keystorePath := "../internal/testutils/repository_data/keystore"
err := testutils.SetupTestDirs(repoPath, targetsPath, keystorePath)
defer testutils.Cleanup()

Expand Down
2 changes: 1 addition & 1 deletion metadata/metadata_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import (

var testRootBytes = []byte("{\"signatures\":[{\"keyid\":\"roothash\",\"sig\":\"1307990e6ba5ca145eb35e99182a9bec46531bc54ddf656a602c780fa0240dee\"}],\"signed\":{\"_type\":\"root\",\"consistent_snapshot\":true,\"expires\":\"2030-08-15T14:30:45.0000001Z\",\"keys\":{\"roothash\":{\"keytype\":\"ed25519\",\"keyval\":{\"public\":\"pubrootval\"},\"scheme\":\"ed25519\"},\"snapshothash\":{\"keytype\":\"ed25519\",\"keyval\":{\"public\":\"pubsval\"},\"scheme\":\"ed25519\"},\"targetshash\":{\"keytype\":\"ed25519\",\"keyval\":{\"public\":\"pubtrval\"},\"scheme\":\"ed25519\"},\"timestamphash\":{\"keytype\":\"ed25519\",\"keyval\":{\"public\":\"pubtmval\"},\"scheme\":\"ed25519\"}},\"roles\":{\"root\":{\"keyids\":[\"roothash\"],\"threshold\":1},\"snapshot\":{\"keyids\":[\"snapshothash\"],\"threshold\":1},\"targets\":{\"keyids\":[\"targetshash\"],\"threshold\":1},\"timestamp\":{\"keyids\":[\"timestamphash\"],\"threshold\":1}},\"spec_version\":\"1.0.31\",\"version\":1}}")

const TEST_REPOSITORY_DATA = "../testutils/repository_data/repository/metadata"
const TEST_REPOSITORY_DATA = "../internal/testutils/repository_data/repository/metadata"

var fixedExpire = time.Date(2030, 8, 15, 14, 30, 45, 100, time.UTC)

Expand Down
8 changes: 4 additions & 4 deletions metadata/trustedmetadata/trustedmetadata_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ import (
"github.com/sigstore/sigstore/pkg/cryptoutils"
"github.com/sigstore/sigstore/pkg/signature"
"github.com/stretchr/testify/assert"
"github.com/theupdateframework/go-tuf/v2/internal/testutils"
"github.com/theupdateframework/go-tuf/v2/metadata"
"github.com/theupdateframework/go-tuf/v2/testutils/testutils"
)

var allRoles map[string][]byte
Expand Down Expand Up @@ -89,9 +89,9 @@ func setAllRolesBytes(path string) {
func TestMain(m *testing.M) {
log := metadata.GetLogger()

repoPath := "../../testutils/repository_data/repository/metadata"
keystorePath := "../../testutils/repository_data/keystore"
targetsPath := "../../testutils/repository_data/repository/targets"
repoPath := "../../internal/testutils/repository_data/repository/metadata"
keystorePath := "../../internal/testutils/repository_data/keystore"
targetsPath := "../../internal/testutils/repository_data/repository/targets"
err := testutils.SetupTestDirs(repoPath, targetsPath, keystorePath)
defer testutils.Cleanup()

Expand Down
2 changes: 1 addition & 1 deletion metadata/updater/updater_consistent_snapshot_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import (

"github.com/stretchr/testify/assert"

"github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator"
"github.com/theupdateframework/go-tuf/v2/metadata"
"github.com/theupdateframework/go-tuf/v2/testutils/simulator"
)

func TestTopLevelRolesUpdateWithConsistentSnapshotDisabled(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions metadata/updater/updater_top_level_update_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ import (
log "github.com/sirupsen/logrus"
"github.com/stretchr/testify/assert"

"github.com/theupdateframework/go-tuf/v2/internal/testutils"
"github.com/theupdateframework/go-tuf/v2/internal/testutils/simulator"
"github.com/theupdateframework/go-tuf/v2/metadata"
"github.com/theupdateframework/go-tuf/v2/metadata/config"
"github.com/theupdateframework/go-tuf/v2/testutils/simulator"
"github.com/theupdateframework/go-tuf/v2/testutils/testutils"
)

func TestMain(m *testing.M) {
Expand Down

0 comments on commit a1b3a1f

Please sign in to comment.