Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix docs and change fields #289

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ func (m *CatalogsManager) UpsertState(ctx context.Context, name string, state mo
}
m.Context.Publish("catalog", v1alpha2.Event{
Metadata: map[string]string{
"objectType": state.Spec.Type,
"objectType": state.Spec.CatalogType,
},
Body: v1alpha2.JobData{
Id: state.ObjectMeta.Name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ var catalogState = model.CatalogState{
Name: "name1",
},
Spec: &model.CatalogSpec{
Type: "catalog",
CatalogType: "catalog",
Properties: map[string]interface{}{
"property1": "value1",
"property2": "value2",
Expand Down Expand Up @@ -234,7 +234,7 @@ func TestGetChains(t *testing.T) {
fmt.Println(v.ObjectMeta.Name)
}

val, err := manager.GetChains(context.Background(), catalogState.Spec.Type, catalogState.ObjectMeta.Namespace)
val, err := manager.GetChains(context.Background(), catalogState.Spec.CatalogType, catalogState.ObjectMeta.Namespace)
assert.Nil(t, err)
assert.Equal(t, 4, len(val["root"]))
}
Expand All @@ -248,7 +248,7 @@ func TestGetTrees(t *testing.T) {
err = manager.setProviderDataIfNecessary(context.Background(), catalogState.ObjectMeta.Namespace)
assert.Nil(t, err)

val, err := manager.GetTrees(context.Background(), catalogState.Spec.Type, catalogState.ObjectMeta.Namespace)
val, err := manager.GetTrees(context.Background(), catalogState.Spec.CatalogType, catalogState.ObjectMeta.Namespace)
assert.Nil(t, err)
assert.Equal(t, 7, len(val["root-0"]))
}
Expand Down
2 changes: 1 addition & 1 deletion api/pkg/apis/v1alpha1/managers/sync/sync-manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func (s *SyncManager) Poll() []error {
for _, catalog := range batch.Catalogs {
s.Context.Publish("catalog-sync", v1alpha2.Event{
Metadata: map[string]string{
"objectType": catalog.Spec.Type,
"objectType": catalog.Spec.CatalogType,
"origin": batch.Origin,
},
Body: v1alpha2.JobData{
Expand Down
2 changes: 1 addition & 1 deletion api/pkg/apis/v1alpha1/managers/sync/sync-manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ func InitiazlizeMockSymphonyAPI(siteId string) *httptest.Server {
Name: "catalog1",
},
Spec: &model.CatalogSpec{
Type: "Instance",
CatalogType: "Instance",
Properties: map[string]interface{}{
"foo": "bar",
},
Expand Down
8 changes: 4 additions & 4 deletions api/pkg/apis/v1alpha1/model/catalog.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ type ObjectRef struct {
Metadata map[string]string `json:"metadata,omitempty"`
}
type CatalogSpec struct {
Type string `json:"type"`
CatalogType string `json:"catalogType"`
Metadata map[string]string `json:"metadata,omitempty"`
Properties map[string]interface{} `json:"properties"`
ParentName string `json:"parentName,omitempty"`
Expand Down Expand Up @@ -97,7 +97,7 @@ func (s CatalogState) GetParent() string {
}
func (s CatalogState) GetType() string {
if s.Spec != nil {
return s.Spec.Type
return s.Spec.CatalogType
}
return ""
}
Expand All @@ -111,7 +111,7 @@ func (s CatalogState) GetProperties() map[string]interface{} {
// IEdge interface
func (s CatalogState) GetFrom() string {
if s.Spec != nil {
if s.Spec.Type == "edge" {
if s.Spec.CatalogType == "edge" {
if s.Spec.Metadata != nil {
if from, ok := s.Spec.Metadata["from"]; ok {
return from
Expand All @@ -124,7 +124,7 @@ func (s CatalogState) GetFrom() string {

func (s CatalogState) GetTo() string {
if s.Spec != nil {
if s.Spec.Type == "edge" {
if s.Spec.CatalogType == "edge" {
if s.Spec.Metadata != nil {
if to, ok := s.Spec.Metadata["to"]; ok {
return to
Expand Down
8 changes: 4 additions & 4 deletions api/pkg/apis/v1alpha1/model/catalog_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func TestCatalogMatch(t *testing.T) {

func TestCatalogMatchOneEmpty(t *testing.T) {
catalog1 := CatalogSpec{
Type: "type",
CatalogType: "type",
Properties: map[string]interface{}{
"key": "value",
},
Expand Down Expand Up @@ -132,7 +132,7 @@ func TestGetProperties(t *testing.T) {
func TestGetType(t *testing.T) {
catalog := CatalogState{
Spec: &CatalogSpec{
Type: "type",
CatalogType: "type",
},
}
assert.Equal(t, catalog.GetType(), "type")
Expand All @@ -144,7 +144,7 @@ func TestGetType(t *testing.T) {
func TestGetFrom(t *testing.T) {
catalog := CatalogState{
Spec: &CatalogSpec{
Type: "edge",
CatalogType: "edge",
Metadata: map[string]string{
"from": "from",
},
Expand All @@ -159,7 +159,7 @@ func TestGetFrom(t *testing.T) {
func TestGetTo(t *testing.T) {
catalog := CatalogState{
Spec: &CatalogSpec{
Type: "edge",
CatalogType: "edge",
Metadata: map[string]string{
"to": "to",
},
Expand Down
27 changes: 11 additions & 16 deletions api/pkg/apis/v1alpha1/model/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,17 @@ type (
// InstanceSpec defines the spec property of the InstanceState
// +kubebuilder:object:generate=true
InstanceSpec struct {
DisplayName string `json:"displayName,omitempty"`
Scope string `json:"scope,omitempty"`
Parameters map[string]string `json:"parameters,omitempty"` //TODO: Do we still need this?
Metadata map[string]string `json:"metadata,omitempty"`
Solution string `json:"solution"`
Target TargetSelector `json:"target,omitempty"`
Topologies []TopologySpec `json:"topologies,omitempty"`
Pipelines []PipelineSpec `json:"pipelines,omitempty"`
Arguments map[string]map[string]string `json:"arguments,omitempty"`
Generation string `json:"generation,omitempty"`
Version string `json:"version,omitempty"`
RootResource string `json:"rootResource,omitempty"`
DisplayName string `json:"displayName,omitempty"`
Scope string `json:"scope,omitempty"`
Parameters map[string]string `json:"parameters,omitempty"` //TODO: Do we still need this?
Metadata map[string]string `json:"metadata,omitempty"`
Solution string `json:"solution"`
Target TargetSelector `json:"target,omitempty"`
Topologies []TopologySpec `json:"topologies,omitempty"`
Pipelines []PipelineSpec `json:"pipelines,omitempty"`
Generation string `json:"generation,omitempty"`
Version string `json:"version,omitempty"`
RootResource string `json:"rootResource,omitempty"`
}

// TargertRefSpec defines the target the instance will deploy to
Expand Down Expand Up @@ -157,10 +156,6 @@ func (c InstanceSpec) DeepEquals(other IDeepEquals) (bool, error) {
return false, nil
}

if !StringStringMapsEqual(c.Arguments, otherC.Arguments, nil) {
return false, nil
}

return true, nil
}

Expand Down
Loading
Loading