Documentation ¶
Overview ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Constants
- func CheckDeploymentReady(obj runtime.Object) (bool, error)
- func CheckExperimentFailure(obj runtime.Object) (bool, error)
- func CheckExperimentFinished(obj runtime.Object) (bool, error)
- func CheckExperimentPause(obj runtime.Object) (bool, error)
- func CheckExperimentSuccess(obj runtime.Object) (bool, error)
- func CheckLatestReadyRevisionName(name string) func(obj runtime.Object) (bool, error)
- func CheckServiceFound(obj runtime.Object) (bool, error)
- func CheckServiceNotFound(reason string) func(obj runtime.Object) (bool, error)
- func CheckServiceReady(obj runtime.Object) (bool, error)
- func GetAbortExperimentResponse() api.Response
- func GetDefaultMockResponse() api.Response
- func GetFailureMockResponse() api.Response
- func GetSuccessMockResponse() api.Response
- func Logger(t *testing.T) logr.Logger
- func WaitForDelete(ctx context.Context, cl client.Client, obj runtime.Object) error
- func WaitForState(ctx context.Context, cl client.Client, obj runtime.Object, inState InStateFunc) error
- type AnalyticsService
- type DeploymentBuilder
- type ExperimentBuilder
- func (b *ExperimentBuilder) Build() *v1alpha1.Experiment
- func (b *ExperimentBuilder) WithAnalyticsHost(host string) *ExperimentBuilder
- func (b *ExperimentBuilder) WithDummySuccessCriterion() *ExperimentBuilder
- func (b *ExperimentBuilder) WithHostInTargetService(host, gateway string) *ExperimentBuilder
- func (b *ExperimentBuilder) WithKNativeService(name string) *ExperimentBuilder
- func (b *ExperimentBuilder) WithKubernetesTargetService(name, baseline, candidate string) *ExperimentBuilder
- func (b *ExperimentBuilder) WithKubernetesTargetServiceKind(kind string) *ExperimentBuilder
- func (b *ExperimentBuilder) WithResumeAction() *ExperimentBuilder
- func (b *ExperimentBuilder) WithSuccessCriterion(sc v1alpha1.SuccessCriterion) *ExperimentBuilder
- type Hook
- func CheckObjectDeleted(objects ...runtime.Object) Hook
- func CreateObject(obj runtime.Object) Hook
- func DeleteExperiment(name string, namespace string) Hook
- func DeleteObject(obj runtime.Object) Hook
- func DeleteObjectIfExists(obj runtime.Object) Hook
- func ResumeExperiment(exp *v1alpha1.Experiment) Hook
- func UpdateObject(obj runtime.Object) Hook
- type InStateFunc
- type KnativeServiceBuilder
- func (b *KnativeServiceBuilder) Build() *servingalpha1.Service
- func (b *KnativeServiceBuilder) WithEnv(name string, value string) *KnativeServiceBuilder
- func (b *KnativeServiceBuilder) WithImage(name string) *KnativeServiceBuilder
- func (b *KnativeServiceBuilder) WithRevision(revisionName string, percent int64) *KnativeServiceBuilder
- type ServiceBuilder
Constants ¶
const (
StockImageName = "villardl/stock-60d7d0dbe2427b272042abacd4e1e644"
)
const (
// TestTag identifies the test id
TestTag = "testid"
)
Variables ¶
This section is empty.
Functions ¶
func CheckExperimentPause ¶ added in v0.1.0
func CheckServiceNotFound ¶
func GetDefaultMockResponse ¶
func GetFailureMockResponse ¶
func GetSuccessMockResponse ¶
func WaitForDelete ¶
WaitForDelete polls the obj existence
func WaitForState ¶
func WaitForState(ctx context.Context, cl client.Client, obj runtime.Object, inState InStateFunc) error
WaitForState polls the status of the object called name from client every `interval` until `inState` returns `true` indicating it is done, returns an error or timeout
Types ¶
type AnalyticsService ¶
type AnalyticsService struct { // Mock maps request to response. The key maps to request.name Mock map[string]api.Response // contains filtered or unexported fields }
AnalyticsService with mock response
func StartAnalytics ¶
func StartAnalytics() *AnalyticsService
StartAnalytics starts fake analytics service
func (*AnalyticsService) AddMock ¶
func (s *AnalyticsService) AddMock(name string, response api.Response)
Mock adds response for testid
func (*AnalyticsService) GetURL ¶
func (s *AnalyticsService) GetURL() string
GetURL returns the service URL
func (*AnalyticsService) ServeHTTP ¶
func (s *AnalyticsService) ServeHTTP(w http.ResponseWriter, r *http.Request)
type DeploymentBuilder ¶
type DeploymentBuilder appsv1.Deployment
func NewKubernetesDeployment ¶
func NewKubernetesDeployment(name, namespace string) *DeploymentBuilder
NewKubernetesDeployment returns a kubernetes deployment
func (*DeploymentBuilder) Build ¶
func (d *DeploymentBuilder) Build() *appsv1.Deployment
Build converts builder to deployment
func (*DeploymentBuilder) WithContainer ¶
func (d *DeploymentBuilder) WithContainer(name, image string, port int) *DeploymentBuilder
WithContainer adds a container spec to the deployment
func (*DeploymentBuilder) WithLabels ¶
func (d *DeploymentBuilder) WithLabels(l map[string]string) *DeploymentBuilder
WithLabels adds labels to the deployment
type ExperimentBuilder ¶
type ExperimentBuilder v1alpha1.Experiment
ExperimentBuilder builds experiment object
func NewExperiment ¶
func NewExperiment(name string, namespace string) *ExperimentBuilder
NewExperiment create a new miminal experiment object
func (*ExperimentBuilder) Build ¶
func (b *ExperimentBuilder) Build() *v1alpha1.Experiment
Build the experiment object
func (*ExperimentBuilder) WithAnalyticsHost ¶
func (b *ExperimentBuilder) WithAnalyticsHost(host string) *ExperimentBuilder
func (*ExperimentBuilder) WithDummySuccessCriterion ¶
func (b *ExperimentBuilder) WithDummySuccessCriterion() *ExperimentBuilder
WithDummySuccessCriterion adds a dummy success criterion
func (*ExperimentBuilder) WithHostInTargetService ¶ added in v0.2.0
func (b *ExperimentBuilder) WithHostInTargetService(host, gateway string) *ExperimentBuilder
func (*ExperimentBuilder) WithKNativeService ¶
func (b *ExperimentBuilder) WithKNativeService(name string) *ExperimentBuilder
WithKNativeService adds KNative target service
func (*ExperimentBuilder) WithKubernetesTargetService ¶
func (b *ExperimentBuilder) WithKubernetesTargetService(name, baseline, candidate string) *ExperimentBuilder
WithKubernetesTargetService adds Kubernetes targetService
func (*ExperimentBuilder) WithKubernetesTargetServiceKind ¶ added in v0.2.0
func (b *ExperimentBuilder) WithKubernetesTargetServiceKind(kind string) *ExperimentBuilder
WithKubernetesTargetServiceKind specifies kind of baseline/candidate
func (*ExperimentBuilder) WithResumeAction ¶ added in v0.1.0
func (b *ExperimentBuilder) WithResumeAction() *ExperimentBuilder
func (*ExperimentBuilder) WithSuccessCriterion ¶
func (b *ExperimentBuilder) WithSuccessCriterion(sc v1alpha1.SuccessCriterion) *ExperimentBuilder
WithSuccessCriterion adds a success criterion
type Hook ¶
Hook defines a function with a client.
func CheckObjectDeleted ¶
func CreateObject ¶ added in v0.1.1
func DeleteExperiment ¶
func DeleteObject ¶
func DeleteObjectIfExists ¶
func ResumeExperiment ¶ added in v0.1.0
func ResumeExperiment(exp *v1alpha1.Experiment) Hook
func UpdateObject ¶ added in v0.1.0
type InStateFunc ¶
func WantAllStates ¶
func WantAllStates(stateFns ...InStateFunc) InStateFunc
type KnativeServiceBuilder ¶
type KnativeServiceBuilder servingalpha1.Service
KnativeServiceBuilder builds Knative service object
func NewKnativeService ¶
func NewKnativeService(name string, namespace string) *KnativeServiceBuilder
NewKnativeService creates a default Knative service with one revision
func (*KnativeServiceBuilder) Build ¶
func (b *KnativeServiceBuilder) Build() *servingalpha1.Service
Build the Knative Service object
func (*KnativeServiceBuilder) WithEnv ¶
func (b *KnativeServiceBuilder) WithEnv(name string, value string) *KnativeServiceBuilder
func (*KnativeServiceBuilder) WithImage ¶
func (b *KnativeServiceBuilder) WithImage(name string) *KnativeServiceBuilder
func (*KnativeServiceBuilder) WithRevision ¶
func (b *KnativeServiceBuilder) WithRevision(revisionName string, percent int64) *KnativeServiceBuilder
type ServiceBuilder ¶
func NewKubernetesService ¶
func NewKubernetesService(name, namespace string) *ServiceBuilder
NewKubernetesService returns a kubernetes service
func (*ServiceBuilder) Build ¶
func (s *ServiceBuilder) Build() *corev1.Service
Build converts builder to service
func (*ServiceBuilder) WithPorts ¶
func (s *ServiceBuilder) WithPorts(ports map[string]int) *ServiceBuilder
WithPorts adds ports to the service
func (*ServiceBuilder) WithSelector ¶
func (s *ServiceBuilder) WithSelector(selector map[string]string) *ServiceBuilder
WithSelector adds selector labels to the service