Bootstrapper

This commit is contained in:
katexochen 2022-06-29 16:17:23 +02:00 committed by Paul Meyer
parent 916e5d6b55
commit dea23604fb
19 changed files with 130 additions and 293 deletions

View file

@ -11,8 +11,9 @@ import (
"testing"
"time"
"github.com/edgelesssys/constellation/bootstrapper/core"
"github.com/edgelesssys/constellation/bootstrapper/role"
"github.com/edgelesssys/constellation/internal/atls"
"github.com/edgelesssys/constellation/internal/cloud/metadata"
"github.com/edgelesssys/constellation/internal/grpc/atlscredentials"
"github.com/edgelesssys/constellation/internal/logger"
"github.com/edgelesssys/constellation/internal/oid"
@ -95,7 +96,7 @@ func TestKeyAPI(t *testing.T) {
api := keyservice.New(
logger.NewTest(t),
atls.NewFakeIssuer(oid.Dummy{}),
&core.ProviderMetadataFake{},
&fakeMetadataAPI{},
20*time.Second,
)
@ -122,3 +123,16 @@ func TestKeyAPI(t *testing.T) {
assert.NoError(err)
assert.Equal(testKey, key)
}
type fakeMetadataAPI struct{}
func (f *fakeMetadataAPI) List(ctx context.Context) ([]metadata.InstanceMetadata, error) {
return []metadata.InstanceMetadata{
{
Name: "instanceName",
ProviderID: "fake://instance-id",
Role: role.Unknown,
PrivateIPs: []string{"192.0.2.1"},
},
}, nil
}