Skip to content

Commit

Permalink
Fix apache#1233: fix dev mode test and rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolaferraro committed Feb 23, 2020
1 parent 2d22ebc commit bf4fdb4
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 10 deletions.
8 changes: 4 additions & 4 deletions deploy/resources.go

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

4 changes: 2 additions & 2 deletions e2e/dev_mode_test.go
Expand Up @@ -48,11 +48,11 @@ func TestRunDevMode(t *testing.T) {
kamelRun := kamelWithContext(ctx, "run", "-n", ns, file, "--dev")
kamelRun.SetOut(pipew)

logScanner := util.NewLogScanner(ctx, piper, "Integration yaml in phase Running", "Magicstring!", "Magicjordan!")
logScanner := util.NewLogScanner(ctx, piper, `integration "yaml" in phase Running`, "Magicstring!", "Magicjordan!")

go kamelRun.Execute()

Eventually(logScanner.IsFound("Integration yaml in phase Running"), 5*time.Minute).Should(BeTrue())
Eventually(logScanner.IsFound(`integration "yaml" in phase Running`), 5*time.Minute).Should(BeTrue())
Eventually(logScanner.IsFound("Magicstring!"), 3*time.Minute).Should(BeTrue())
Expect(logScanner.IsFound("Magicjordan!")()).To(BeFalse())

Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/run.go
Expand Up @@ -305,7 +305,7 @@ func (o *runCmdOptions) waitForIntegrationReady(cmd *cobra.Command, integration
//
if i.Status.Phase != "" {
// TODO remove this log when we make sure that events are always created
fmt.Printf("progress: integration %q in phase %s\n", integration.Name, string(i.Status.Phase))
fmt.Fprintf(cmd.OutOrStdout(), "Progress: integration %q in phase %s\n", integration.Name, string(i.Status.Phase))
}
if i.Status.Phase == v1.IntegrationPhaseRunning || i.Status.Phase == v1.IntegrationPhaseError {
return false
Expand Down
10 changes: 7 additions & 3 deletions pkg/install/operator.go
Expand Up @@ -25,6 +25,7 @@ import (

appsv1 "k8s.io/api/apps/v1"
"k8s.io/api/rbac/v1beta1"
k8serrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"

Expand Down Expand Up @@ -126,7 +127,10 @@ func OperatorOrCollect(ctx context.Context, c client.Client, cfg OperatorConfigu
return installKnative(ctx, c, cfg.Namespace, customizer, collection, force)
}

if errevt := installEvents(ctx, c, cfg.Namespace, customizer, collection); errevt != nil {
if errevt := installEvents(ctx, c, cfg.Namespace, customizer, collection, force); errevt != nil {
if k8serrors.IsAlreadyExists(err) {
return err
}
fmt.Println("Warning: the operator will not be able to publish Kubernetes events. Try installing as cluster-admin to allow it to generate events.")
}

Expand Down Expand Up @@ -158,8 +162,8 @@ func installKnative(ctx context.Context, c client.Client, namespace string, cust
)
}

func installEvents(ctx context.Context, c client.Client, namespace string, customizer ResourceCustomizer, collection *kubernetes.Collection) error {
return ResourcesOrCollect(ctx, c, namespace, collection, customizer,
func installEvents(ctx context.Context, c client.Client, namespace string, customizer ResourceCustomizer, collection *kubernetes.Collection, force bool) error {
return ResourcesOrCollect(ctx, c, namespace, collection, force, customizer,
"operator-role-events.yaml",
"operator-role-binding-events.yaml",
)
Expand Down

0 comments on commit bf4fdb4

Please sign in to comment.