Skip to content

Update e2e test data for test-framework #2129

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

Merged
merged 2 commits into from
Nov 9, 2019
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
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ require (
github.com/ghodss/yaml v1.0.1-0.20180820084758-c7ce16629ff4
github.com/go-logr/logr v0.1.0
github.com/go-logr/zapr v0.1.1
github.com/go-openapi/spec v0.19.0
github.com/gobuffalo/packr v1.30.1 // indirect
github.com/gobwas/glob v0.2.3 // indirect
github.com/huandu/xstrings v1.2.0 // indirect
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,22 @@ spec:
status: {}
validation:
openAPIV3Schema:
description: MemcachedRS is the Schema for the memcachedrs API
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources'
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds'
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: MemcachedRSSpec defines the desired state of MemcachedRS
properties:
numNodes:
format: int32
Expand All @@ -36,6 +38,7 @@ spec:
- numNodes
type: object
status:
description: MemcachedRSStatus defines the observed state of MemcachedRS
properties:
nodeList:
items:
Expand All @@ -47,6 +50,7 @@ spec:
- nodeList
- test
type: object
type: object
version: v1alpha1
versions:
- name: v1alpha1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,38 +10,48 @@ spec:
plural: memcacheds
singular: memcached
scope: Namespaced
subresources:
status: {}
validation:
openAPIV3Schema:
description: Memcached is the Schema for the memcacheds API
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: MemcachedSpec defines the desired state of Memcached
properties:
size:
description: Size is the size of the memcached deployment
format: int32
type: integer
test:
type: string
required:
- size
type: object
status:
description: MemcachedStatus defines the observed state of Memcached
properties:
nodes:
description: Nodes are the names of the memcached pods
items:
type: string
type: array
required:
- nodes
type: object
type: object
version: v1alpha1
versions:
- name: v1alpha1
served: true
storage: true
subresources:
status: {}
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ type MemcachedRSStatus struct {
// MemcachedRS is the Schema for the memcachedrs API
// +k8s:openapi-gen=true
// +kubebuilder:subresource:status
// +kubebuilder:resource:path=memcachedrs,scope=Namespaced
type MemcachedRS struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

221 changes: 221 additions & 0 deletions test/test-framework/pkg/apis/cache/v1alpha1/zz_generated.openapi.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,221 @@
// +build !ignore_autogenerated
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you remove this file? The SDK doesn't use this generated code.

Side note: I'm considering removing the generator for this file, since most SDK users do not use it, or at least make it optional.

Copy link
Contributor Author

@camilamacedo86 camilamacedo86 Nov 6, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HI @estroz the update of the project has been done using the SDK so it will be generated since its commands generate it. Note that the goal is also to add a check to ensure that the mock data is updated with the current code source implementation always to avoid we are testing it with something that should be changed already. See #2131 for we add the test in the sanity.

So, if in the future we remove this file and/or change the commands then the test-framework should be updated accordingly to pass in the CI. Is it make sense?

PS.: I am trying here give the first steps for we stop to do changes manually on it regards the gen artefacts and in this avoid unexpected scenarios as well.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For now we can keep it here. If we decide that removing the openapi generator is the right way to go we can remove this file.


// This file was autogenerated by openapi-gen. Do not edit it manually!

package v1alpha1

import (
spec "github.com/go-openapi/spec"
common "k8s.io/kube-openapi/pkg/common"
)

func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenAPIDefinition {
return map[string]common.OpenAPIDefinition{
"github.com/operator-framework/operator-sdk/test/test-framework/pkg/apis/cache/v1alpha1.Memcached": schema_pkg_apis_cache_v1alpha1_Memcached(ref),
"github.com/operator-framework/operator-sdk/test/test-framework/pkg/apis/cache/v1alpha1.MemcachedRS": schema_pkg_apis_cache_v1alpha1_MemcachedRS(ref),
"github.com/operator-framework/operator-sdk/test/test-framework/pkg/apis/cache/v1alpha1.MemcachedRSSpec": schema_pkg_apis_cache_v1alpha1_MemcachedRSSpec(ref),
"github.com/operator-framework/operator-sdk/test/test-framework/pkg/apis/cache/v1alpha1.MemcachedRSStatus": schema_pkg_apis_cache_v1alpha1_MemcachedRSStatus(ref),
"github.com/operator-framework/operator-sdk/test/test-framework/pkg/apis/cache/v1alpha1.MemcachedSpec": schema_pkg_apis_cache_v1alpha1_MemcachedSpec(ref),
"github.com/operator-framework/operator-sdk/test/test-framework/pkg/apis/cache/v1alpha1.MemcachedStatus": schema_pkg_apis_cache_v1alpha1_MemcachedStatus(ref),
}
}

func schema_pkg_apis_cache_v1alpha1_Memcached(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "Memcached is the Schema for the memcacheds API",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"kind": {
SchemaProps: spec.SchemaProps{
Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
Type: []string{"string"},
Format: "",
},
},
"apiVersion": {
SchemaProps: spec.SchemaProps{
Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
Type: []string{"string"},
Format: "",
},
},
"metadata": {
SchemaProps: spec.SchemaProps{
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"),
},
},
"spec": {
SchemaProps: spec.SchemaProps{
Ref: ref("github.com/operator-framework/operator-sdk/test/test-framework/pkg/apis/cache/v1alpha1.MemcachedSpec"),
},
},
"status": {
SchemaProps: spec.SchemaProps{
Ref: ref("github.com/operator-framework/operator-sdk/test/test-framework/pkg/apis/cache/v1alpha1.MemcachedStatus"),
},
},
},
},
},
Dependencies: []string{
"github.com/operator-framework/operator-sdk/test/test-framework/pkg/apis/cache/v1alpha1.MemcachedSpec", "github.com/operator-framework/operator-sdk/test/test-framework/pkg/apis/cache/v1alpha1.MemcachedStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"},
}
}

func schema_pkg_apis_cache_v1alpha1_MemcachedRS(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "MemcachedRS is the Schema for the memcachedrs API",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"kind": {
SchemaProps: spec.SchemaProps{
Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
Type: []string{"string"},
Format: "",
},
},
"apiVersion": {
SchemaProps: spec.SchemaProps{
Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
Type: []string{"string"},
Format: "",
},
},
"metadata": {
SchemaProps: spec.SchemaProps{
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"),
},
},
"spec": {
SchemaProps: spec.SchemaProps{
Ref: ref("github.com/operator-framework/operator-sdk/test/test-framework/pkg/apis/cache/v1alpha1.MemcachedRSSpec"),
},
},
"status": {
SchemaProps: spec.SchemaProps{
Ref: ref("github.com/operator-framework/operator-sdk/test/test-framework/pkg/apis/cache/v1alpha1.MemcachedRSStatus"),
},
},
},
},
},
Dependencies: []string{
"github.com/operator-framework/operator-sdk/test/test-framework/pkg/apis/cache/v1alpha1.MemcachedRSSpec", "github.com/operator-framework/operator-sdk/test/test-framework/pkg/apis/cache/v1alpha1.MemcachedRSStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"},
}
}

func schema_pkg_apis_cache_v1alpha1_MemcachedRSSpec(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "MemcachedRSSpec defines the desired state of MemcachedRS",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"numNodes": {
SchemaProps: spec.SchemaProps{
Type: []string{"integer"},
Format: "int32",
},
},
},
Required: []string{"numNodes"},
},
},
}
}

func schema_pkg_apis_cache_v1alpha1_MemcachedRSStatus(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "MemcachedRSStatus defines the observed state of MemcachedRS",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"nodeList": {
VendorExtensible: spec.VendorExtensible{
Extensions: spec.Extensions{
"x-kubernetes-list-type": "set",
},
},
SchemaProps: spec.SchemaProps{
Type: []string{"array"},
Items: &spec.SchemaOrArray{
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Type: []string{"string"},
Format: "",
},
},
},
},
},
"test": {
SchemaProps: spec.SchemaProps{
Type: []string{"boolean"},
Format: "",
},
},
},
Required: []string{"nodeList", "test"},
},
},
}
}

func schema_pkg_apis_cache_v1alpha1_MemcachedSpec(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "MemcachedSpec defines the desired state of Memcached",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"size": {
SchemaProps: spec.SchemaProps{
Description: "Size is the size of the memcached deployment",
Type: []string{"integer"},
Format: "int32",
},
},
},
Required: []string{"size"},
},
},
}
}

func schema_pkg_apis_cache_v1alpha1_MemcachedStatus(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "MemcachedStatus defines the observed state of Memcached",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"nodes": {
VendorExtensible: spec.VendorExtensible{
Extensions: spec.Extensions{
"x-kubernetes-list-type": "set",
},
},
SchemaProps: spec.SchemaProps{
Description: "Nodes are the names of the memcached pods",
Type: []string{"array"},
Items: &spec.SchemaOrArray{
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Type: []string{"string"},
Format: "",
},
},
},
},
},
},
Required: []string{"nodes"},
},
},
}
}