Skip to content

Commit

Permalink
remove -a flag; do not tag e2e
Browse files Browse the repository at this point in the history
Tagging e2e is not necessary and has some undesired side effect such as
excluding these e2e source files from building/linting, which can
invisibilise some problems
  • Loading branch information
jotak committed Dec 12, 2024
1 parent e799bc4 commit 6c7b8fe
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 18 deletions.
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,12 @@ docker-generate: ## Create the container that generates the eBPF binaries
.PHONY: compile
compile: ## Compile ebpf agent project
@echo "### Compiling project"
GOARCH=${GOARCH} GOOS=$(GOOS) go build -mod vendor -a -o bin/netobserv-ebpf-agent cmd/netobserv-ebpf-agent.go
GOARCH=${GOARCH} GOOS=$(GOOS) go build -mod vendor -o bin/netobserv-ebpf-agent cmd/netobserv-ebpf-agent.go

.PHONY: test
test: ## Test code using go test
@echo "### Testing code"
GOOS=$(GOOS) go test -mod vendor -a ./... -coverpkg=./... -coverprofile cover.all.out
GOOS=$(GOOS) go test -mod vendor ./pkg/... ./cmd/... -coverpkg=./... -coverprofile cover.all.out

.PHONY: cov-exclude-generated
cov-exclude-generated:
Expand All @@ -171,6 +171,7 @@ tests-e2e: prereqs ## Run e2e tests
go clean -testcache
# making the local agent image available to kind in two ways, so it will work in different
# environments: (1) as image tagged in the local repository (2) as image archive.
rm -f ebpf-agent.tar || true
$(OCI_BIN) build . --build-arg LDFLAGS="" --build-arg TARGETARCH=$(GOARCH) -t localhost/ebpf-agent:test
$(OCI_BIN) save -o ebpf-agent.tar localhost/ebpf-agent:test
GOOS=$(GOOS) go test -p 1 -timeout 30m -v -mod vendor -tags e2e ./e2e/...
Expand Down
10 changes: 4 additions & 6 deletions e2e/basic/common.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
//go:build e2e

package basic

import (
Expand Down Expand Up @@ -37,7 +35,7 @@ func (bt *FlowCaptureTester) DoTest(t *testing.T, isIPFIX bool) {
return ctx
},
).Assess("correctness of client -> server (as Service) request flows",
func(ctx context.Context, t *testing.T, cfg *envconf.Config) context.Context {
func(ctx context.Context, t *testing.T, _ *envconf.Config) context.Context {
lq := bt.lokiQuery(t,
`{DstK8S_OwnerName="server",SrcK8S_OwnerName="client"}`+
`|="\"DstAddr\":\"`+pci.serverServiceIP+`\""`)
Expand Down Expand Up @@ -82,7 +80,7 @@ func (bt *FlowCaptureTester) DoTest(t *testing.T, isIPFIX bool) {
return ctx
},
).Assess("correctness of client -> server (as Pod) request flows",
func(ctx context.Context, t *testing.T, cfg *envconf.Config) context.Context {
func(ctx context.Context, t *testing.T, _ *envconf.Config) context.Context {
lq := bt.lokiQuery(t,
`{DstK8S_OwnerName="server",SrcK8S_OwnerName="client"}`+
`|="\"DstAddr\":\"`+pci.serverPodIP+`\""`)
Expand Down Expand Up @@ -124,7 +122,7 @@ func (bt *FlowCaptureTester) DoTest(t *testing.T, isIPFIX bool) {
return ctx
},
).Assess("correctness of server (from Service) -> client response flows",
func(ctx context.Context, t *testing.T, cfg *envconf.Config) context.Context {
func(ctx context.Context, t *testing.T, _ *envconf.Config) context.Context {
lq := bt.lokiQuery(t,
`{DstK8S_OwnerName="client",SrcK8S_OwnerName="server"}`+
`|="\"SrcAddr\":\"`+pci.serverServiceIP+`\""`)
Expand Down Expand Up @@ -167,7 +165,7 @@ func (bt *FlowCaptureTester) DoTest(t *testing.T, isIPFIX bool) {
return ctx
},
).Assess("correctness of server (from Pod) -> client response flows",
func(ctx context.Context, t *testing.T, cfg *envconf.Config) context.Context {
func(ctx context.Context, t *testing.T, _ *envconf.Config) context.Context {
lq := bt.lokiQuery(t,
`{DstK8S_OwnerName="client",SrcK8S_OwnerName="server"}`+
`|="\"SrcAddr\":\"`+pci.serverPodIP+`\""`)
Expand Down
2 changes: 0 additions & 2 deletions e2e/basic/flow_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
//go:build e2e

package basic

import (
Expand Down
2 changes: 0 additions & 2 deletions e2e/ipfix/ipfix_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
//go:build e2e

package basic

import (
Expand Down
12 changes: 6 additions & 6 deletions e2e/kafka/kafka_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
//go:build e2e

package basic

import (
Expand Down Expand Up @@ -92,27 +90,29 @@ func checkResources(client klient.Client, list ...string) bool {
return false
}
deplInfo := []string{}
for _, p := range depl.Items {
for i := range depl.Items {
p := &depl.Items[i]
deplInfo = append(deplInfo, fmt.Sprintf("%s (%d/%d)", p.Name, p.Status.ReadyReplicas, p.Status.Replicas))
if _, toCheck := ready[p.Name]; toCheck {
ready[p.Name] = p.Status.ReadyReplicas == 1
}
}
klog.Infof("Deployments: " + strings.Join(deplInfo, ", "))
klog.Infof("Deployments: %s", strings.Join(deplInfo, ", "))
var sfs appsv1.StatefulSetList
err = client.Resources(namespace).List(context.TODO(), &sfs)
if err != nil {
klog.Errorf("Can't list stateful sets: %v", err)
return false
}
sfsInfo := []string{}
for _, p := range sfs.Items {
for i := range sfs.Items {
p := &sfs.Items[i]
sfsInfo = append(sfsInfo, fmt.Sprintf("%s (%d/%d/%d)", p.Name, p.Status.ReadyReplicas, p.Status.AvailableReplicas, p.Status.Replicas))
if _, toCheck := ready[p.Name]; toCheck {
ready[p.Name] = p.Status.ReadyReplicas == 1
}
}
klog.Infof("StatefulSets: " + strings.Join(sfsInfo, ", "))
klog.Infof("StatefulSets: %s", strings.Join(sfsInfo, ", "))
for _, state := range ready {
if !state {
return false
Expand Down

0 comments on commit 6c7b8fe

Please sign in to comment.