Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
jimassa committed Dec 12, 2024
1 parent d5bd99e commit 2bf3819
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 5 deletions.
6 changes: 5 additions & 1 deletion test/e2e/common/validate-metric.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ import (
prom "github.com/microsoft/retina/test/e2e/framework/prometheus"
)

var (
ErrMetricFound = errors.New("unexpected metric found")
)

type ValidateMetric struct {
ForwardedPort string
MetricName string
Expand All @@ -31,7 +35,7 @@ func (v *ValidateMetric) Run() error {

// if we expect the metric not to be found, return an error if it is found
if !v.ExpectMetric {
return fmt.Errorf("did not expect to find metric %s matching %+v", v.MetricName, validMetric)
return fmt.Errorf("did not expect to find metric %s matching %+v: %w", v.MetricName, validMetric, ErrMetricFound)
}

log.Printf("found metric %s matching %+v\n", v.MetricName, validMetric)
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/framework/constants/networking.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const (
IPV4 = "IPv4"
IPTableRuleDrop = "IPTABLE_RULE_DROP"
SYN = "SYN"
SYN_ACK = "SYN-ACK"
SYNACK = "SYN-ACK"
ACK = "ACK"
FIN = "FIN"
RST = "RST"
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/jobs/jobs.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ func InstallAndTestHubbleMetrics(kubeConfigFilePath, chartPath string, testPodNa
hubbleScrenarios := []*types.Scenario{
hubble_dns.ValidateDNSMetric(),
hubble_flow.ValidateFlowMetric(),
//hubble_drop.ValidateDropMetric(),
// hubble_drop.ValidateDropMetric(), TODO Needs to investigate why drop metrics are not present.
hubble_tcp.ValidateTCPMetric(),
hubble_service.ValidateHubbleRelayService(),
hubble_service.ValidateHubbleUIService(kubeConfigFilePath),
Expand Down
1 change: 1 addition & 0 deletions test/e2e/scenarios/hubble/flow/labels.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ var (

validHubbleFlowMetricsLabels = []map[string]string{
validHubbleFlowLabelsToStack,
// TODO: Needs to further investigate why these labels are not being generated
// validHubbleFlowLabelsToNetwork,
// validHubbleFlowLabelsFromNetwork,
validHubbleFlowLabelsToEndpoint,
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/scenarios/hubble/tcp/labels.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ var (
constants.HubbleSourceLabel: "",
constants.HubbleDestinationLabel: common.TestPodNamespace + "/" + podName,
constants.HubbleFamilyLabel: constants.IPV4,
constants.HubbleFlagLabel: constants.SYN_ACK,
constants.HubbleFlagLabel: constants.SYNACK,
}
validHubbleTCPFINFlag = map[string]string{
constants.HubbleSourceLabel: "",
Expand All @@ -28,7 +28,7 @@ var (

validHubbleTCPMetricsLabels = []map[string]string{
validHubbleTCPSYNFlag,
//validHubbleTCPSYNACKFlag,
// validHubbleTCPSYNACKFlag, TODO: Needs to further investigate why these labels are not being generated
validHubbleTCPFINFlag,
}
)

0 comments on commit 2bf3819

Please sign in to comment.