Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[test] fix integration tests #19692

Merged
merged 14 commits into from
May 7, 2024
2 changes: 1 addition & 1 deletion dev/preview/infrastructure/modules/gce/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ variable "dev_kube_context" {
variable "vm_image" {
type = string
description = "The VM image"
default = "gitpod-k3s-202402021944"
default = "gitpod-k3s-202404302137"
}

variable "cert_issuer" {
Expand Down
2 changes: 1 addition & 1 deletion dev/preview/infrastructure/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ variable "vm_type" {
variable "vm_image" {
type = string
description = "The VM image"
default = "gitpod-k3s-202402021944"
default = "gitpod-k3s-202404302137"
}

variable "cert_issuer" {
Expand Down
1 change: 1 addition & 0 deletions dev/preview/workflow/preview/deploy-gitpod.sh
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ then
--kubeconfig "${PREVIEW_K3S_KUBE_PATH}" \
--context "${PREVIEW_K3S_KUBE_CONTEXT}" \
apply -n ${PREVIEW_NAMESPACE} -f -
yq w -i "${INSTALLER_CONFIG_PATH}" experimental.webapp.server.StripeSecret "stripe-api-keys"
fi

#
Expand Down
16 changes: 8 additions & 8 deletions test/tests/components/ws-manager/prebuild_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ func TestOpenWorkspaceFromPrebuild(t *testing.T) {
// launch the workspace from prebuild
// TODO: change to use server API to launch the workspace, so we could run the integration test as the user code flow
// which is client -> server -> ws-manager rather than client -> ws-manager directly
ws, stopWs, err := integration.LaunchWorkspaceDirectly(t, ctx, api, integration.WithRequestModifier(func(req *wsmanapi.StartWorkspaceRequest) error {
ws, stopWsFunc, err := integration.LaunchWorkspaceDirectly(t, ctx, api, integration.WithRequestModifier(func(req *wsmanapi.StartWorkspaceRequest) error {
req.Spec.FeatureFlags = test.FF
req.Spec.Initializer = &csapi.WorkspaceInitializer{
Spec: &csapi.WorkspaceInitializer_Prebuild{
Expand Down Expand Up @@ -301,7 +301,7 @@ func TestOpenWorkspaceFromPrebuild(t *testing.T) {

t.Cleanup(func() {
// stop workspace in defer function to prevent we forget to stop the workspace
if err := stopWorkspace(t, cfg, stopWs); err != nil {
if err := stopWorkspace(t, cfg, stopWsFunc); err != nil {
t.Errorf("cannot stop workspace: %q", err)
}
})
Expand Down Expand Up @@ -343,14 +343,14 @@ func TestOpenWorkspaceFromPrebuild(t *testing.T) {
sapi := integration.NewComponentAPI(sctx, cfg.Namespace(), kubeconfig, cfg.Client())
defer sapi.Done(t)

// stop workspace without wait
_, err = stopWs(false, sapi)
// stop workspace and wait, we're about to restart it
_, err = stopWsFunc(true, sapi)
if err != nil {
t.Fatal(err)
}

// reopen the workspace and make sure the file foobar.txt exists
ws1, stopWs1, err := integration.LaunchWorkspaceDirectly(t, ctx, sapi, integration.WithRequestModifier(func(req *wsmanapi.StartWorkspaceRequest) error {
ws1, stopWs1Func, err := integration.LaunchWorkspaceDirectly(t, ctx, sapi, integration.WithRequestModifier(func(req *wsmanapi.StartWorkspaceRequest) error {
req.ServicePrefix = ws.Req.ServicePrefix
req.Metadata.MetaId = ws.Req.Metadata.MetaId
req.Metadata.Owner = ws.Req.Metadata.Owner
Expand All @@ -372,7 +372,7 @@ func TestOpenWorkspaceFromPrebuild(t *testing.T) {

t.Cleanup(func() {
// stop workspace in defer function to prevent we forget to stop the workspace
if err := stopWorkspace(t, cfg, stopWs1); err != nil {
if err := stopWorkspace(t, cfg, stopWs1Func); err != nil {
t.Errorf("cannot stop workspace: %q", err)
}
})
Expand Down Expand Up @@ -593,7 +593,7 @@ func checkPrebuildLogExist(t *testing.T, cfg *envconf.Config, rsa *integration.R
Command: "bash",
Args: []string{
"-c",
fmt.Sprintf("grep %s *", prebuildLog),
fmt.Sprintf("grep -r %s *", prebuildLog),
},
}, &grepResp)
if err == nil && grepResp.ExitCode == 0 && strings.Trim(grepResp.Stdout, " \t\n") != "" {
Expand All @@ -603,7 +603,7 @@ func checkPrebuildLogExist(t *testing.T, cfg *envconf.Config, rsa *integration.R
return
}

t.Logf("cannot found the prebuild message %s in %s, err:%v, exitCode:%d, stdout:%s", prebuildLog, prebuildLogPath, err, grepResp.ExitCode, grepResp.Stdout)
t.Logf("cannot found the prebuild message %s in %s, err:%v, exitCode:%d, stdout:%s, stderr:%s", prebuildLog, prebuildLogPath, err, grepResp.ExitCode, grepResp.Stdout, grepResp.Stderr)

// somehow, the prebuild log message '🍊 This task ran as a workspace prebuild' does not exists
// we fall back to check the init task message within the /workspace/.gitpod/prebuild-log-* or not
Expand Down
4 changes: 3 additions & 1 deletion test/tests/workspace/process_priority_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ func TestProcessPriority(t *testing.T) {
}
defer rsa.Close()

t.Logf("running ps")
t.Logf("waiting for the next ws-daemon tick, before running ps")
time.Sleep(15 * time.Second)

var res agent.ExecResponse
err = rsa.Call("WorkspaceAgent.Exec", &agent.ExecRequest{
Dir: "/workspace",
Expand Down