chore: resolve noctx linter issues (#1265)

- Use exec.CommandContext instead of exec.Command in e2e tests
- Use db.PrepareContext instead of db.Prepare in MySQL datastore
This commit is contained in:
Ross Golder
2026-08-10 17:01:21 +02:00
committed by GitHub
parent 7a064d66a4
commit 55bb5b1dd5
2 changed files with 9 additions and 6 deletions
+8 -5
View File
@@ -43,8 +43,8 @@ func PrintTenantControlPlaneInfo() {
tcp := tcpList.Items[0]
kubectlExec := func(args ...string) {
cmd := exec.Command("kubectl")
kubectlExec := func(ctx context.Context, args ...string) {
cmd := exec.CommandContext(ctx, "kubectl")
var out bytes.Buffer
cmd.Stdout = &out
@@ -65,20 +65,23 @@ func PrintTenantControlPlaneInfo() {
if CurrentSpecReport().Failed() {
_, _ = fmt.Fprintln(GinkgoWriter, "DEBUG: Tenant Control Plane definition")
kubectlExec(
fmt.Sprintf("--namespace=%s", tcp.GetNamespace()),
context.Background(),
"--namespace="+tcp.GetNamespace(),
"get",
"tcp",
tcp.GetName(),
)
_, _ = fmt.Fprintln(GinkgoWriter, "DEBUG: Tenant Control Plane resources")
kubectlExec(
fmt.Sprintf("--namespace=%s", tcp.GetNamespace()),
context.Background(),
"--namespace="+tcp.GetNamespace(),
"get",
"svc,deployment,pods,ep,configmap,secrets",
)
_, _ = fmt.Fprintln(GinkgoWriter, "DEBUG: Tenant Control Plane pods")
kubectlExec(
fmt.Sprintf("--namespace=%s", tcp.GetNamespace()),
context.Background(),
"--namespace="+tcp.GetNamespace(),
"describe",
"pods",
)
+1 -1
View File
@@ -316,7 +316,7 @@ func (c *MySQLConnection) RevokePrivileges(ctx context.Context, user, dbName str
}
func (c *MySQLConnection) check(ctx context.Context, nonFilledStatement string, checker func(*sql.Row) (bool, error), args ...any) (bool, error) {
statement, err := c.db.Prepare(nonFilledStatement)
statement, err := c.db.PrepareContext(ctx, nonFilledStatement)
if err != nil {
return false, err
}