-
Notifications
You must be signed in to change notification settings - Fork 13
/
util.go
39 lines (33 loc) · 1.09 KB
/
util.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package util
import (
"fmt"
cdv2 "github.com/gardener/component-spec/bindings-go/apis/v2"
"github.com/stretchr/testify/assert"
)
// DummyTestingT is a utility struct for using assertions from "github.com/stretchr/testify/assert"
// in the integration tests (outside of unit tests)
type DummyTestingT struct{}
var _ assert.TestingT = DummyTestingT{}
func (t DummyTestingT) Errorf(format string, args ...interface{}) {
fmt.Printf(format, args...)
}
func CreateComponentDescriptor(name, version, baseURL string) *cdv2.ComponentDescriptor {
repoCtx, _ := cdv2.NewUnstructured(cdv2.NewOCIRegistryRepository(baseURL, ""))
cd := &cdv2.ComponentDescriptor{
Metadata: cdv2.Metadata{
Version: cdv2.SchemaVersion,
},
ComponentSpec: cdv2.ComponentSpec{
ObjectMeta: cdv2.ObjectMeta{
Name: name,
Version: version,
},
Provider: cdv2.InternalProvider,
RepositoryContexts: []*cdv2.UnstructuredTypedObject{&repoCtx},
Resources: []cdv2.Resource{},
Sources: []cdv2.Source{},
ComponentReferences: []cdv2.ComponentReference{},
},
}
return cd
}