E2E: extend timeout on CSI snapshot test (#19338)

The EBS snapshot operation can take a long time to complete. Recent runs have
shown we sometimes get up to the 10s timeout on the context we're giving the CLI
command. Extend this so that we're not getting spurious timeouts.

Fixes: https://github.com/hashicorp/nomad/issues/19118
This commit is contained in:
Tim Gross
2023-12-06 16:34:54 -05:00
committed by GitHub
parent 36f69a8e88
commit 340c9ebd47

View File

@@ -4,7 +4,9 @@
package csi
import (
"context"
"fmt"
"os/exec"
"time"
"github.com/hashicorp/nomad/e2e/e2eutil"
@@ -195,8 +197,12 @@ func (tc *CSIControllerPluginEBSTest) TestVolumeClaim(f *framework.F) {
// TestSnapshot exercises the snapshot commands.
func (tc *CSIControllerPluginEBSTest) TestSnapshot(f *framework.F) {
out, err := e2eutil.Command("nomad", "volume", "snapshot", "create",
tc.volumeIDs[0], "snap-"+tc.uuid)
// EBS snapshots can take a very long time to run
ctx, cancel := context.WithTimeout(context.Background(), time.Second*30)
defer cancel()
bytes, err := exec.CommandContext(ctx, "nomad", "volume", "snapshot", "create",
tc.volumeIDs[0], "snap-"+tc.uuid).CombinedOutput()
out := string(bytes)
requireNoErrorElseDump(f, err, "could not create volume snapshot", tc.pluginJobIDs)
snaps, err := e2eutil.ParseColumns(out)