Skip to content

Commit

Permalink
update e2e to use new cluster create/destory apis
Browse files Browse the repository at this point in the history
Signed-off-by: Mohamed Mahmoud <[email protected]>
  • Loading branch information
msherif1234 committed Nov 22, 2023
1 parent edeec54 commit d4db970
Show file tree
Hide file tree
Showing 33 changed files with 2,775 additions and 518 deletions.
1 change: 1 addition & 0 deletions e2e/basic/flow_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"github.com/mariomac/guara/pkg/test"
"github.com/netobserv/netobserv-ebpf-agent/e2e/cluster"
"github.com/netobserv/netobserv-ebpf-agent/e2e/cluster/tester"

"github.com/sirupsen/logrus"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
Expand Down
12 changes: 8 additions & 4 deletions e2e/cluster/kind.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
rt2 "runtime"

"github.com/netobserv/netobserv-ebpf-agent/e2e/cluster/tester"

"github.com/sirupsen/logrus"
"github.com/vladimirvivien/gexe"
"k8s.io/apimachinery/pkg/api/meta"
Expand All @@ -34,6 +35,7 @@ import (
"sigs.k8s.io/e2e-framework/pkg/env"
"sigs.k8s.io/e2e-framework/pkg/envconf"
"sigs.k8s.io/e2e-framework/pkg/envfuncs"
"sigs.k8s.io/e2e-framework/support/kind"
)

// DeployOrder specifies the order in which a Deployment must be executed, from lower to higher
Expand Down Expand Up @@ -170,9 +172,11 @@ func NewKind(kindClusterName, baseDir string, options ...Option) *Kind {
// Run the Kind cluster for the later execution of tests.
func (k *Kind) Run(m *testing.M) {
envFuncs := []env.Func{
envfuncs.CreateKindClusterWithConfig(k.clusterName,
kindImage,
path.Join(packageDir(), "base", "00-kind.yml")),
withTimeout(envfuncs.CreateClusterWithConfig(
kind.NewProvider(),
k.clusterName,
path.Join(packageDir(), "base", "00-kind.yml"),
kind.WithImage(kindImage)), k.timeout),
k.loadLocalImage(),
}
// Deploy base cluster dependencies and wait for readiness (if needed)
Expand All @@ -195,7 +199,7 @@ func (k *Kind) Run(m *testing.M) {
code := k.testEnv.Setup(envFuncs...).
Finish(
k.exportLogs(),
envfuncs.DestroyKindCluster(k.clusterName),
withTimeout(envfuncs.DestroyCluster(k.clusterName), k.timeout),
).Run(m)
log.WithField("returnCode", code).Info("tests finished run")
}
Expand Down
3 changes: 2 additions & 1 deletion e2e/kafka/kafka_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (

"github.com/netobserv/netobserv-ebpf-agent/e2e/basic"
"github.com/netobserv/netobserv-ebpf-agent/e2e/cluster"

"github.com/sirupsen/logrus"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
Expand Down Expand Up @@ -61,7 +62,7 @@ func TestMain(m *testing.M) {
ResourceMatch(&kfk, func(object k8s.Object) bool {
return object.(*Kafka).Status.Ready()
}),
wait.WithTimeout(testTimeout),
wait.WithInterval(5*time.Second), wait.WithTimeout(testTimeout),
); err != nil {
return fmt.Errorf("waiting for kafka cluster to be ready: %w", err)
}
Expand Down
2 changes: 0 additions & 2 deletions e2e/kafka/manifests/11-kafka-cluster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ metadata:
name: kafka-cluster
spec:
kafka:
version: 3.1.0
replicas: 1
listeners:
- name: plain
Expand All @@ -25,7 +24,6 @@ spec:
transaction.state.log.min.isr: 1
default.replication.factor: 1
min.insync.replicas: 1
inter.broker.protocol.version: "3.1"
storage:
type: ephemeral
resources:
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ require (
k8s.io/api v0.28.4
k8s.io/apimachinery v0.28.4
k8s.io/client-go v0.28.4
sigs.k8s.io/e2e-framework v0.0.6
sigs.k8s.io/e2e-framework v0.3.0
)

require (
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -294,8 +294,8 @@ k8s.io/utils v0.0.0-20230406110748-d93618cff8a2 h1:qY1Ad8PODbnymg2pRbkyMT/ylpTrC
k8s.io/utils v0.0.0-20230406110748-d93618cff8a2/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
sigs.k8s.io/controller-runtime v0.15.1 h1:9UvgKD4ZJGcj24vefUFgZFP3xej/3igL9BsOUTb/+4c=
sigs.k8s.io/controller-runtime v0.15.1/go.mod h1:7ngYvp1MLT+9GeZ+6lH3LOlcHkp/+tzA/fmHa4iq9kk=
sigs.k8s.io/e2e-framework v0.0.6 h1:mGalOzsc25nz4GBOD6oVWBFKFcAanMso6oj3+4wiCFw=
sigs.k8s.io/e2e-framework v0.0.6/go.mod h1:XSknNb1ovbtOyNNjV8DKuY9Nr4rta4wwtnZq3IRGMl0=
sigs.k8s.io/e2e-framework v0.3.0 h1:eqQALBtPCth8+ulTs6lcPK7ytV5rZSSHJzQHZph4O7U=
sigs.k8s.io/e2e-framework v0.3.0/go.mod h1:C+ef37/D90Dc7Xq1jQnNbJYscrUGpxrWog9bx2KIa+c=
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo=
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0=
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 h1:PRbqxJClWWYMNV1dhaG4NsibJbArud9kFxnAMREiWFE=
Expand Down
10 changes: 10 additions & 0 deletions vendor/k8s.io/utils/pointer/OWNERS

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

3 changes: 3 additions & 0 deletions vendor/k8s.io/utils/pointer/README.md

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

Loading

0 comments on commit d4db970

Please sign in to comment.