-
Notifications
You must be signed in to change notification settings - Fork 489
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
driver(container): fix conditional statement for error handling
Signed-off-by: CrazyMax <[email protected]>
- Loading branch information
Showing
4 changed files
with
57 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package tests | ||
|
||
import ( | ||
"strings" | ||
"testing" | ||
|
||
"github.com/moby/buildkit/util/testutil/integration" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func createCmd(sb integration.Sandbox, opts ...cmdOpt) (string, error) { | ||
opts = append([]cmdOpt{withArgs("create")}, opts...) | ||
cmd := buildxCmd(sb, opts...) | ||
out, err := cmd.CombinedOutput() | ||
return string(out), err | ||
} | ||
|
||
var createTests = []func(t *testing.T, sb integration.Sandbox){ | ||
testCreateMemoryLimit, | ||
} | ||
|
||
func testCreateMemoryLimit(t *testing.T, sb integration.Sandbox) { | ||
if sb.Name() != "docker-container" { | ||
t.Skip("only testing for docker-container driver") | ||
} | ||
|
||
var builderName string | ||
t.Cleanup(func() { | ||
if builderName == "" { | ||
return | ||
} | ||
out, err := rmCmd(sb, withArgs(builderName)) | ||
require.NoError(t, err, out) | ||
}) | ||
|
||
out, err := createCmd(sb, withArgs("--driver", "docker-container", "--driver-opt", "memory=1g")) | ||
require.NoError(t, err, out) | ||
builderName = strings.TrimSpace(out) | ||
|
||
out, err = inspectCmd(sb, withArgs(builderName, "--bootstrap")) | ||
require.NoError(t, err, out) | ||
Check failure on line 41 in tests/create.go GitHub Actions / test (docker-container, ./tests)Failed: tests/TestIntegration/TestCreateMemoryLimit/worker=docker-container
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package tests | ||
|
||
import ( | ||
"github.com/moby/buildkit/util/testutil/integration" | ||
) | ||
|
||
func rmCmd(sb integration.Sandbox, opts ...cmdOpt) (string, error) { | ||
opts = append([]cmdOpt{withArgs("rm")}, opts...) | ||
cmd := buildxCmd(sb, opts...) | ||
out, err := cmd.CombinedOutput() | ||
return string(out), err | ||
} |