-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[tests] Add integration tests for docker
- Loading branch information
Showing
5 changed files
with
126 additions
and
1 deletion.
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
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,48 @@ | ||
// Copyright (c) 2021 Gitpod GmbH. All rights reserved. | ||
// Licensed under the GNU Affero General Public License (AGPL). | ||
// See License-AGPL.txt in the project root for license information. | ||
|
||
package workspace_test | ||
|
||
import ( | ||
"testing" | ||
"time" | ||
|
||
"github.com/gitpod-io/gitpod/test/pkg/integration" | ||
agent "github.com/gitpod-io/gitpod/test/tests/workspace/workspace_agent/api" | ||
) | ||
|
||
func TestRunDocker(t *testing.T) { | ||
it, _ := integration.NewTest(t, 5*time.Minute) | ||
defer it.Done() | ||
|
||
ws := integration.LaunchWorkspaceDirectly(it) | ||
instanceID := ws.Req.Id | ||
defer integration.DeleteWorkspace(it, ws.Req.Id) | ||
|
||
rsa, err := it.Instrument(integration.ComponentWorkspace, "workspace", integration.WithInstanceID(instanceID), integration.WithWorkspacekitLift(true)) | ||
if err != nil { | ||
t.Error(err) | ||
return | ||
} | ||
defer rsa.Close() | ||
|
||
var resp agent.ExecResponse | ||
err = rsa.Call("WorkspaceAgent.Exec", &agent.ExecRequest{ | ||
Dir: "/", | ||
Command: "bash", | ||
Args: []string{ | ||
"-c", | ||
"docker run --rm alpine:latest", | ||
}, | ||
}, &resp) | ||
if err != nil { | ||
t.Errorf("docker run failed: %v\n%s\n%s", err, resp.Stdout, resp.Stderr) | ||
return | ||
} | ||
|
||
if resp.ExitCode != 0 { | ||
t.Errorf("docker run failed: %s\n%s", resp.Stdout, resp.Stderr) | ||
return | ||
} | ||
} |
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