Skip to content

Commit

Permalink
XXX: Bumped test tiemouts, build timeouts and small fix to kits copy
Browse files Browse the repository at this point in the history
  • Loading branch information
valdar committed Apr 18, 2024
1 parent 0312d46 commit 520b593
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 27 deletions.
2 changes: 1 addition & 1 deletion e2e/advanced/build_order_strategy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func TestRunBuildOrderStrategyMatchingDependencies(t *testing.T) {
WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
operatorID := "camel-k-build-order-deps"
g.Expect(CopyCamelCatalog(t, ctx, ns, operatorID)).To(Succeed())
g.Expect(CopyIntegrationKits(t, ctx, ns, operatorID)).To(Succeed())
//g.Expect(CopyIntegrationKits(t, ctx, ns, operatorID)).To(Succeed())
g.Expect(KamelInstallWithID(t, ctx, operatorID, ns, "--max-running-pipelines", "4", "--build-order-strategy", string(v1.BuildOrderStrategyDependencies))).To(Succeed())
g.Eventually(PlatformPhase(t, ctx, ns), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))

Expand Down
4 changes: 2 additions & 2 deletions e2e/advanced/builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func TestBuilderTimeout(t *testing.T) {
WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
operatorID := fmt.Sprintf("camel-k-%s", ns)
g.Expect(CopyCamelCatalog(t, ctx, ns, operatorID)).To(Succeed())
g.Expect(CopyIntegrationKits(t, ctx, ns, operatorID)).To(Succeed())
//g.Expect(CopyIntegrationKits(t, ctx, ns, operatorID)).To(Succeed())
g.Expect(KamelInstallWithID(t, ctx, operatorID, ns)).To(Succeed())
g.Eventually(OperatorPod(t, ctx, ns)).ShouldNot(BeNil())
g.Eventually(Platform(t, ctx, ns)).ShouldNot(BeNil())
Expand Down Expand Up @@ -79,7 +79,7 @@ func TestBuilderTimeout(t *testing.T) {
// After a few minutes (5 max retries), this has to be in error state
g.Eventually(BuildPhase(t, ctx, ns, integrationKitName), TestTimeoutMedium).Should(Equal(v1.BuildPhaseError))
g.Eventually(IntegrationPhase(t, ctx, ns, name), TestTimeoutMedium).Should(Equal(v1.IntegrationPhaseError))
g.Eventually(BuildFailureRecovery(t, ctx, ns, integrationKitName), TestTimeoutMedium).Should(Equal(5))
g.Eventually(BuildFailureRecoveryAttempt(t, ctx, ns, integrationKitName), TestTimeoutMedium).Should(Equal(5))
g.Eventually(BuilderPodPhase(t, ctx, ns, builderKitName), TestTimeoutMedium).Should(Equal(corev1.PodFailed))
})
})
Expand Down
2 changes: 1 addition & 1 deletion e2e/advanced/operator_id_filtering_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func TestOperatorIDFiltering(t *testing.T) {
WithNewTestNamespace(t, func(ctx context.Context, g *WithT, nsop1 string) {
operator1 := "operator-1"
g.Expect(CopyCamelCatalog(t, ctx, nsop1, operator1)).To(Succeed())
g.Expect(CopyIntegrationKits(t, ctx, nsop1, operator1)).To(Succeed())
//g.Expect(CopyIntegrationKits(t, ctx, nsop1, operator1)).To(Succeed())
g.Expect(KamelInstallWithIDAndKameletCatalog(t, ctx, operator1, nsop1, "--global", "--force")).To(Succeed())
g.Eventually(PlatformPhase(t, ctx, nsop1), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))

Expand Down
14 changes: 5 additions & 9 deletions e2e/common/misc/integration_fail_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,8 @@ func TestBadRouteIntegration(t *testing.T) {
integrationKitNamespace := IntegrationKitNamespace(t, ctx, ns, name)()
g.Eventually(KitPhase(t, ctx, integrationKitNamespace, kitName), TestTimeoutShort).Should(Equal(v1.IntegrationKitPhaseError))
//Build in error with 5 attempts
build := Build(t, ctx, integrationKitNamespace, kitName)()
g.Eventually(build.Status.Phase, TestTimeoutShort).Should(Equal(v1.BuildPhaseError))
g.Eventually(build.Status.Failure.Recovery.Attempt, TestTimeoutShort).Should(Equal(5))
g.Eventually(BuildPhase(t, ctx, integrationKitNamespace, kitName), TestTimeoutShort).Should(Equal(v1.BuildPhaseError))
g.Eventually(BuildFailureRecoveryAttempt(t, ctx, integrationKitNamespace, kitName), TestTimeoutShort).Should(Equal(5))

// Fixing the route should reconcile the Integration
g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java", "--name", name).Execute()).To(Succeed())
Expand All @@ -99,8 +98,7 @@ func TestBadRouteIntegration(t *testing.T) {
g.Eventually(KitPhase(t, ctx, integrationKitRecoveryNamespace, kitRecoveryName), TestTimeoutShort).Should(Equal(v1.IntegrationKitPhaseReady))
g.Expect(kitRecoveryName).NotTo(Equal(kitName))
// New Build success
buildRecovery := Build(t, ctx, integrationKitRecoveryNamespace, kitRecoveryName)()
g.Eventually(buildRecovery.Status.Phase, TestTimeoutShort).Should(Equal(v1.BuildPhaseSucceeded))
g.Eventually(BuildPhase(t, ctx, integrationKitRecoveryNamespace, kitRecoveryName), TestTimeoutShort).Should(Equal(v1.BuildPhaseSucceeded))

})

Expand Down Expand Up @@ -129,8 +127,7 @@ func TestBadRouteIntegration(t *testing.T) {
integrationKitRecoveryNamespace := IntegrationKitNamespace(t, ctx, ns, name)()
g.Eventually(KitPhase(t, ctx, integrationKitRecoveryNamespace, kitRecoveryName), TestTimeoutShort).Should(Equal(v1.IntegrationKitPhaseReady))
// New Build success
buildRecovery := Build(t, ctx, integrationKitRecoveryNamespace, kitRecoveryName)()
g.Eventually(buildRecovery.Status.Phase, TestTimeoutShort).Should(Equal(v1.BuildPhaseSucceeded))
g.Eventually(BuildPhase(t, ctx, integrationKitRecoveryNamespace, kitRecoveryName), TestTimeoutShort).Should(Equal(v1.BuildPhaseSucceeded))
})

t.Run("run unresolvable component java route", func(t *testing.T) {
Expand Down Expand Up @@ -158,8 +155,7 @@ func TestBadRouteIntegration(t *testing.T) {
integrationKitRecoveryNamespace := IntegrationKitNamespace(t, ctx, ns, name)()
g.Eventually(KitPhase(t, ctx, integrationKitRecoveryNamespace, kitRecoveryName), TestTimeoutShort).Should(Equal(v1.IntegrationKitPhaseReady))
// New Build success
buildRecovery := Build(t, ctx, integrationKitRecoveryNamespace, kitRecoveryName)()
g.Eventually(buildRecovery.Status.Phase, TestTimeoutShort).Should(Equal(v1.BuildPhaseSucceeded))
g.Eventually(BuildPhase(t, ctx, integrationKitRecoveryNamespace, kitRecoveryName), TestTimeoutShort).Should(Equal(v1.BuildPhaseSucceeded))
})

t.Run("run invalid java route", func(t *testing.T) {
Expand Down
26 changes: 14 additions & 12 deletions e2e/support/test_support.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,9 @@ const ExpectedOSClusterRoles = 1

var TestDefaultNamespace = "default"

var TestTimeoutShort = 1 * time.Minute
var TestTimeoutMedium = 5 * time.Minute
var TestTimeoutLong = 15 * time.Minute
var TestTimeoutShort = 5 * time.Minute
var TestTimeoutMedium = 20 * time.Minute
var TestTimeoutLong = 30 * time.Minute

// TestTimeoutVeryLong should be used only for testing native builds.
var TestTimeoutVeryLong = 60 * time.Minute
Expand Down Expand Up @@ -1925,7 +1925,7 @@ func BuildCondition(t *testing.T, ctx context.Context, ns string, name string, c
}
}

func BuildFailureRecovery(t *testing.T, ctx context.Context, ns, name string) func() int {
func BuildFailureRecoveryAttempt(t *testing.T, ctx context.Context, ns, name string) func() int {
return func() int {
build := Build(t, ctx, ns, name)()
if build != nil {
Expand Down Expand Up @@ -1996,21 +1996,23 @@ func CopyIntegrationKits(t *testing.T, ctx context.Context, ns, operatorID strin
failTest(t, err)
}
for _, kit := range lst.Items {
if kit.Status.Image != "" {
if kit.Status.Image != "" && kit.Status.Phase == v1.IntegrationKitPhaseReady {
copyKit := v1.IntegrationKit{
ObjectMeta: metav1.ObjectMeta{
Namespace: ns,
Name: kit.Name,
Labels: kit.Labels,
},
Spec: *kit.Spec.DeepCopy(),
Spec: *kit.Spec.DeepCopy(),
Status: *kit.Status.DeepCopy(),
}

if copyKit.Labels == nil {
copyKit.Labels = make(map[string]string)
}

copyKit.Labels[v1.IntegrationKitTypeLabel] = v1.IntegrationKitTypeExternal
copyKit.Spec.Image = kit.Status.Image
//if copyKit.Labels == nil {
// copyKit.Labels = make(map[string]string)
//}
//
//copyKit.Labels[v1.IntegrationKitTypeLabel] = v1.IntegrationKitTypeExternal
//copyKit.Spec.Image = kit.Status.Image

v1.SetAnnotation(&copyKit.ObjectMeta, v1.OperatorIDAnnotation, operatorID)
fmt.Printf("Copy integration kit %s from namespace %s\n", kit.Name, opns)
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/integrationplatform/initialize_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func TestTimeouts_Default(t *testing.T) {
require.NoError(t, err)
assert.NotNil(t, answer)

assert.Equal(t, 5*time.Minute, answer.Status.Build.GetTimeout().Duration)
assert.Equal(t, 10*time.Minute, answer.Status.Build.GetTimeout().Duration)
}

func TestTimeouts_MavenComputedFromBuild(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/platform/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ func setPlatformDefaults(p *v1.IntegrationPlatform, verbose bool) error {
// Build timeout
if p.Status.Build.GetTimeout().Duration == 0 {
p.Status.Build.Timeout = &metav1.Duration{
Duration: 5 * time.Minute,
Duration: 10 * time.Minute,
}
} else {
d := p.Status.Build.GetTimeout().Duration.Truncate(time.Second)
Expand Down

0 comments on commit 520b593

Please sign in to comment.