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.
Index ¶
- Constants
- func CheckDeploymentReady(obj runtime.Object) (bool, error)
- func CheckExperimentCompleted(obj runtime.Object) (bool, error)
- func CheckExperimentPause(obj runtime.Object) (bool, error)
- func CheckServiceFound(obj runtime.Object) (bool, error)
- func CheckServiceNotFound(reason string) func(obj runtime.Object) (bool, error)
- func GetAbortExperimentResponse(instance *iter8v1alpha2.Experiment) analyticsv1alpha2.Response
- func GetRollToWinnerMockResponse(instance *iter8v1alpha2.Experiment, winIdx int) analyticsv1alpha2.Response
- func GetRollbackMockResponse(instance *iter8v1alpha2.Experiment) analyticsv1alpha2.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() *v1alpha2.Experiment
- func (b *ExperimentBuilder) WithAnalyticsEndpoint(host string) *ExperimentBuilder
- func (b *ExperimentBuilder) WithCriterion(c v1alpha2.Criterion) *ExperimentBuilder
- func (b *ExperimentBuilder) WithDummyCriterion() *ExperimentBuilder
- func (b *ExperimentBuilder) WithHostInTargetService(host, gateway string) *ExperimentBuilder
- func (b *ExperimentBuilder) WithKubernetesTargetService(name, baseline string, candidates []string) *ExperimentBuilder
- func (b *ExperimentBuilder) WithResumeAction() *ExperimentBuilder
- func (b *ExperimentBuilder) WithRouterID(id string) *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 *v1alpha2.Experiment) Hook
- func UpdateObject(obj runtime.Object) Hook
- type InStateFunc
- type ServiceBuilder
Constants ¶
const (
StockImageName = "villardl/stock-60d7d0dbe2427b272042abacd4e1e644"
)
Variables ¶
This section is empty.
Functions ¶
func CheckExperimentPause ¶ added in v0.1.0
func CheckServiceNotFound ¶
func GetAbortExperimentResponse ¶
func GetAbortExperimentResponse(instance *iter8v1alpha2.Experiment) analyticsv1alpha2.Response
func GetRollToWinnerMockResponse ¶
func GetRollToWinnerMockResponse(instance *iter8v1alpha2.Experiment, winIdx int) analyticsv1alpha2.Response
func GetRollbackMockResponse ¶
func GetRollbackMockResponse(instance *iter8v1alpha2.Experiment) analyticsv1alpha2.Response
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]analyticsv1alpha2.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 analyticsv1alpha2.Response)
AddMock 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 v1alpha2.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() *v1alpha2.Experiment
Build the experiment object
func (*ExperimentBuilder) WithAnalyticsEndpoint ¶
func (b *ExperimentBuilder) WithAnalyticsEndpoint(host string) *ExperimentBuilder
func (*ExperimentBuilder) WithCriterion ¶
func (b *ExperimentBuilder) WithCriterion(c v1alpha2.Criterion) *ExperimentBuilder
WithCriterion adds a criterion
func (*ExperimentBuilder) WithDummyCriterion ¶
func (b *ExperimentBuilder) WithDummyCriterion() *ExperimentBuilder
WithDummyCriterion adds a dummy criterion
func (*ExperimentBuilder) WithHostInTargetService ¶ added in v0.2.0
func (b *ExperimentBuilder) WithHostInTargetService(host, gateway string) *ExperimentBuilder
func (*ExperimentBuilder) WithKubernetesTargetService ¶
func (b *ExperimentBuilder) WithKubernetesTargetService(name, baseline string, candidates []string) *ExperimentBuilder
WithKubernetesTargetService adds Kubernetes targetService
func (*ExperimentBuilder) WithResumeAction ¶ added in v0.1.0
func (b *ExperimentBuilder) WithResumeAction() *ExperimentBuilder
func (*ExperimentBuilder) WithRouterID ¶
func (b *ExperimentBuilder) WithRouterID(id string) *ExperimentBuilder
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 *v1alpha2.Experiment) Hook
func UpdateObject ¶ added in v0.1.0
type InStateFunc ¶
func WantAllStates ¶
func WantAllStates(stateFns ...InStateFunc) InStateFunc
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