Skip to content

Commit

Permalink
Fall back to unqualified mkswap (#979)
Browse files Browse the repository at this point in the history
Some platforms, e.g. bionic, have mkswap under a different folder.
We haven't had any problems running mkswap unqualified on bionic, or
anywhere outside of SLES really, so add a fallback to the unqualified
version of the command if the absolute version fails.
  • Loading branch information
jefferbrecht authored Nov 16, 2022
1 parent 5080fd1 commit 0192d87
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions integration_test/ops_agent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1655,8 +1655,8 @@ func testDefaultMetrics(ctx context.Context, t *testing.T, logger *logging.Direc
_, err := gce.RunRemotely(ctx, logger.ToMainLog(), vm, "", strings.Join([]string{
"sudo dd if=/dev/zero of=/swapfile bs=1024 count=102400",
"sudo chmod 600 /swapfile",
"sudo /usr/sbin/mkswap /swapfile",
"sudo /usr/sbin/swapon /swapfile",
"(sudo mkswap /swapfile || sudo /usr/sbin/mkswap /swapfile)",
"(sudo swapon /swapfile || sudo /usr/sbin/swapon /swapfile)",
}, " && "))
if err != nil {
t.Fatalf("Failed to enable swap file: %v", err)
Expand Down

0 comments on commit 0192d87

Please sign in to comment.