Skip to content

Commit

Permalink
Try unmarshalling and changing equality comparison.
Browse files Browse the repository at this point in the history
  • Loading branch information
tecarter94 committed Jul 9, 2024
1 parent 91da4d6 commit e97c56c
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions openshift-with-appstudio-test/e2e/basictests.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import (
"fmt"
"github.com/redhat-appstudio/jvm-build-service/pkg/reconciler/util"
"io"
"knative.dev/pkg/kmp"
"os"
"path/filepath"
"sigs.k8s.io/yaml"
"slices"
"strings"
"testing"
"time"
Expand Down Expand Up @@ -107,6 +107,12 @@ func runPipelineTests(t *testing.T, doSetup func(t *testing.T, namespace string)
javaVersion: 11
disabledPlugins:
- "foo:bar"`
var buildRecipe v1alpha1.BuildRecipe
err = yaml.Unmarshal([]byte(cfgMap.Data["build.yaml"]), &buildRecipe)
if err != nil {
debugAndFailTest(ta, fmt.Sprintf("unable to read unmarshal build recipe for dependencybuild repo %s: %s", db.Spec.ScmInfo.SCMURL, err.Error()))
return
}
_, err = kubeClient.CoreV1().ConfigMaps(ta.ns).Create(context.TODO(), &cfgMap, metav1.CreateOptions{})
if err != nil {
debugAndFailTest(ta, fmt.Sprintf("unable to create configmap %s for dependencybuild repo %s: %s", cfgMap.Name, db.Spec.ScmInfo.SCMURL, err.Error()))
Expand Down Expand Up @@ -188,7 +194,8 @@ disabledPlugins:
containsRecipe := false
for _, ba := range retrievedDb.Status.BuildAttempts {
ta.Logf(fmt.Sprintf("%+v", ba.Recipe))
if ba.Recipe.JavaVersion == "11" && slices.Contains(ba.Recipe.DisabledPlugins, "foo:bar") {
samePluginsDisabled, _ := kmp.SafeEqual(ba.Recipe.DisabledPlugins, buildRecipe.DisabledPlugins)
if ba.Recipe.JavaVersion == buildRecipe.JavaVersion && samePluginsDisabled {
containsRecipe = true
}
}
Expand Down

0 comments on commit e97c56c

Please sign in to comment.