Skip to content

Commit

Permalink
Logs and test renames to ease debugging (#648)
Browse files Browse the repository at this point in the history
Two minor imrovements added in this PR that will help debugging some remaining flakes:

logs added to createPlan. Currently we only had events and those are not printed in logs
rename of objects in one of the tests, that was sharing names with other test

Co-authored-by: kensipe <ken@mesosphere.io>
  • Loading branch information
alenkacz and kensipe committed Jul 25, 2019
1 parent e4d1ae7 commit fa217f9
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 12 deletions.
2 changes: 2 additions & 0 deletions pkg/controller/instance/instance_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@ func instanceEventFilter(mgr manager.Manager) predicate.Funcs {
func createPlan(mgr manager.Manager, planName string, instance *kudov1alpha1.Instance) error {
gvk, _ := apiutil.GVKForObject(instance, mgr.GetScheme())
recorder := mgr.GetEventRecorderFor("instance-controller")
log.Printf("Creating PlanExecution of plan %s for instance %s", planName, instance.Name)
recorder.Event(instance, "Normal", "CreatePlanExecution", fmt.Sprintf("Creating \"%v\" plan execution", planName))

ref := corev1.ObjectReference{
Expand Down Expand Up @@ -354,6 +355,7 @@ func createPlan(mgr manager.Manager, planName string, instance *kudov1alpha1.Ins
recorder.Event(instance, "Warning", "CreatePlanExecution", fmt.Sprintf("Error creating planexecution \"%v\": %v", planExecution.Name, err))
return err
}
log.Printf("Created PlanExecution of plan %s for instance %s", planName, instance.Name)
recorder.Event(instance, "Normal", "PlanCreated", fmt.Sprintf("PlanExecution \"%v\" created", planExecution.Name))
return nil
}
Expand Down
10 changes: 5 additions & 5 deletions test/integration/create-operator-in-operator/00-dream.yaml
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
## Dream is the umbrella operator that tests the creation of instances within an operator
## operator-in-operator is the umbrella operator that tests the creation of instances within an operator
apiVersion: kudo.dev/v1alpha1
kind: Operator
metadata:
labels:
controller-tools.k8s.io: "1.0"
name: dream
name: operator-in-operator
---
apiVersion: kudo.dev/v1alpha1
kind: OperatorVersion
metadata:
labels:
controller-tools.k8s.io: "1.0"
name: dream-v1
name: operator-in-operator-v1
spec:
version: "1.0.0"
connectionString: ""
operator:
name: dream
name: operator-in-operator
kind: Operator
templates:
operator.yaml: |
apiVersion: kudo.dev/v1alpha1
kind: Instance
metadata:
name: operator
name: inner-instance
labels:
kudo.dev/operator: test-operator
spec:
Expand Down
6 changes: 3 additions & 3 deletions test/integration/create-operator-in-operator/01-assert.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
apiVersion: kudo.dev/v1alpha1
kind: Instance
metadata:
name: dream1
name: oio-instance
status:
status: COMPLETE
---
apiVersion: kudo.dev/v1alpha1
kind: Instance
metadata:
name: dream1-operator
name: oio-instance-inner-instance
status:
status: COMPLETE
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: dream1-operator-nginx
name: oio-instance-inner-instance-nginx
spec:
replicas: 0
8 changes: 4 additions & 4 deletions test/integration/create-operator-in-operator/01-install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ kind: Instance
metadata:
labels:
controller-tools.k8s.io: "1.0"
kudo.dev/operator: dream
name: dream1
kudo.dev/operator: operator-in-operator
name: oio-instance
spec:
operatorVersion:
name: dream-v1
kind: OperatorVersion
name: operator-in-operator-v1
kind: OperatorVersion

0 comments on commit fa217f9

Please sign in to comment.