Skip to content
This repository has been archived by the owner on May 26, 2023. It is now read-only.

Add sign tests #76

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions pkg/commands/componentarchive/signature/signature_suite_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package signature_test

import (
"context"
"path/filepath"
"testing"

"github.com/go-logr/logr"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"

"github.com/gardener/component-cli/ociclient"
"github.com/gardener/component-cli/ociclient/cache"
"github.com/gardener/component-cli/ociclient/credentials"
"github.com/gardener/component-cli/ociclient/test/envtest"
"github.com/gardener/component-cli/pkg/logger"
)

func TestConfig(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "signature Test Suite")
}

var (
testenv *envtest.Environment
client ociclient.ExtendedClient
ociCache cache.Cache
keyring *credentials.GeneralOciKeyring
)

var _ = BeforeSuite(func() {
testenv = envtest.New(envtest.Options{
RegistryBinaryPath: filepath.Join("../../../../", envtest.DefaultRegistryBinaryPath),
Stdout: GinkgoWriter,
Stderr: GinkgoWriter,
})
Expect(testenv.Start(context.Background())).To(Succeed())

keyring = credentials.New()
Expect(keyring.AddAuthConfig(testenv.Addr, credentials.AuthConfig{
Username: testenv.BasicAuth.Username,
Password: testenv.BasicAuth.Password,
})).To(Succeed())
ociCache = cache.NewInMemoryCache()
var err error
client, err = ociclient.NewClient(logr.Discard(), ociclient.WithKeyring(keyring), ociclient.WithCache(ociCache))
Expect(err).ToNot(HaveOccurred())

logger.SetLogger(logr.Discard())
}, 60)

var _ = AfterSuite(func() {
Expect(testenv.Close()).To(Succeed())
})
Loading