Skip to content

Commit

Permalink
polish code comment and add test to codecov ignore path
Browse files Browse the repository at this point in the history
Signed-off-by: shawnh2 <shawnhxh@outlook.com>
  • Loading branch information
shawnh2 committed Apr 26, 2024
1 parent dde05a9 commit 12c6c64
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
1 change: 1 addition & 0 deletions .github/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ coverage:
if_ci_failed: error
ignore:
- "cmd"
- "test"
- "**/*.pb.go"
- "**/zz_generated.deepcopy.go"
6 changes: 3 additions & 3 deletions test/e2e/tests/envoy_shutdown.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ var EnvoyShutdownTest = suite.ConformanceTest{
},
}

// gets the proxy deployment created for a gateway, assuming merge-gateways is not used
// getDeploymentForGateway gets the proxy deployment created for a gateway, assuming merge-gateways is not used.
func getDeploymentForGateway(namespace, name string, c client.Client) (*appsv1.Deployment, error) {
dpLabels := proxy.EnvoyAppLabel()
owningLabels := gatewayapi.GatewayOwnerLabels(namespace, name)
Expand All @@ -122,8 +122,8 @@ func getDeploymentForGateway(namespace, name string, c client.Client) (*appsv1.D
return &ret, nil
}

// sets the "gateway.envoyproxy.io/restartedAt" annotation in the EnvoyProxy resource's deployment patch spec
// leading to EG triggering a rollout restart of the deployment
// restartProxyAndWaitForRollout sets the "gateway.envoyproxy.io/restartedAt" annotation in the
// EnvoyProxy resource's deployment patch spec leading to EG triggering a rollout restart of the deployment.
func restartProxyAndWaitForRollout(t *testing.T, timeoutConfig config.TimeoutConfig, c client.Client, epNN types.NamespacedName, dp *appsv1.Deployment) error {
t.Helper()
const egRestartAnnotation = "gateway.envoyproxy.io/restartedAt"
Expand Down
8 changes: 3 additions & 5 deletions test/e2e/tests/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,13 @@ import (
"fortio.org/fortio/fhttp"
"fortio.org/fortio/periodic"
flog "fortio.org/log"

"github.com/google/go-cmp/cmp"
"github.com/stretchr/testify/require"

corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/util/wait"

"sigs.k8s.io/controller-runtime/pkg/client"
gwv1a2 "sigs.k8s.io/gateway-api/apis/v1alpha2"
"sigs.k8s.io/gateway-api/conformance/utils/config"
Expand Down Expand Up @@ -151,7 +148,7 @@ func AlmostEquals(actual, expect, offset int) bool {
return true
}

// runs a load test with options described in opts
// runLoadAndWait runs a load test with options described in opts
// the done channel is used to notify caller of execution result
// the execution may end due to an external abort or timeout
func runLoadAndWait(t *testing.T, timeoutConfig config.TimeoutConfig, done chan bool, aborter *periodic.Aborter, reqURL string) {
Expand Down Expand Up @@ -186,8 +183,9 @@ func runLoadAndWait(t *testing.T, timeoutConfig config.TimeoutConfig, done chan

if okReq == totalReq && errorReq == 0 && !timedOut {
done <- true
} else {
done <- false
}
done <- false
}

func policyAcceptedByAncestor(ancestors []gwv1a2.PolicyAncestorStatus, controllerName string, ancestorRef gwv1a2.ParentReference) bool {
Expand Down

0 comments on commit 12c6c64

Please sign in to comment.