-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
tests: Stop and Wait for workspace at the end of each tests #12572
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -137,6 +137,8 @@ args=() | |
args+=( "-kubeconfig=/home/gitpod/.kube/config" ) | ||
args+=( "-namespace=default" ) | ||
[[ "$USERNAME" != "" ]] && args+=( "-username=$USERNAME" ) | ||
args+=( "-timeout=60m" ) | ||
args+=( "-p=1" ) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this to run each test binary in parallel? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, opposite. this makes the test serial. |
||
|
||
WK_TEST_LIST=(/workspace/test/tests/components/content-service /workspace/test/tests/components/image-builder /workspace/test/tests/components/ws-daemon /workspace/test/tests/components/ws-manager /workspace/test/tests/workspace) | ||
for TEST_PATH in "${WK_TEST_LIST[@]}" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,9 @@ import ( | |
"bytes" | ||
"context" | ||
"encoding/json" | ||
"errors" | ||
"fmt" | ||
"io" | ||
"net" | ||
"net/rpc" | ||
"os" | ||
|
@@ -53,14 +55,23 @@ func NewPodExec(config rest.Config, clientset *kubernetes.Clientset) *PodExec { | |
} | ||
|
||
func (p *PodExec) PodCopyFile(src string, dst string, containername string) (*bytes.Buffer, *bytes.Buffer, *bytes.Buffer, error) { | ||
ioStreams, in, out, errOut := genericclioptions.NewTestIOStreams() | ||
copyOptions := kubectlcp.NewCopyOptions(ioStreams) | ||
copyOptions.Clientset = p.Clientset | ||
copyOptions.ClientConfig = p.RestConfig | ||
copyOptions.Container = containername | ||
err := copyOptions.Run([]string{src, dst}) | ||
if err != nil { | ||
return nil, nil, nil, fmt.Errorf("Could not run copy operation: %v", err) | ||
var in, out, errOut *bytes.Buffer | ||
var ioStreams genericclioptions.IOStreams | ||
for { | ||
ioStreams, in, out, errOut = genericclioptions.NewTestIOStreams() | ||
copyOptions := kubectlcp.NewCopyOptions(ioStreams) | ||
copyOptions.Clientset = p.Clientset | ||
copyOptions.ClientConfig = p.RestConfig | ||
copyOptions.Container = containername | ||
err := copyOptions.Run([]string{src, dst}) | ||
if err != nil { | ||
if !errors.Is(err, io.EOF) { | ||
return nil, nil, nil, fmt.Errorf("Could not run copy operation: %v", err) | ||
} | ||
time.Sleep(10 * time.Second) | ||
continue | ||
} | ||
break | ||
} | ||
return in, out, errOut, nil | ||
} | ||
|
@@ -187,20 +198,21 @@ func Instrument(component ComponentType, agentName string, namespace string, kub | |
} | ||
|
||
execErrs := make(chan error, 1) | ||
go func() { | ||
execF := func() { | ||
defer close(execErrs) | ||
_, _, _, execErr := podExec.ExecCmd(cmd, podName, namespace, containerName) | ||
if execErr != nil { | ||
execErrs <- execErr | ||
} | ||
}() | ||
} | ||
go execF() | ||
select { | ||
case err := <-execErrs: | ||
if err != nil { | ||
return nil, closer, err | ||
} | ||
return nil, closer, fmt.Errorf("agent stopped unexepectedly") | ||
case <-time.After(1 * time.Second): | ||
case <-time.After(30 * time.Second): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My understanding is, this is the wait time in-between test binaries. Yes? In other words, this is not the wait time each individual test that we run. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I accused this time means waiting time for the start-up of the agent |
||
} | ||
|
||
ctx, cancel := context.WithCancel(context.Background()) | ||
|
@@ -230,7 +242,7 @@ func Instrument(component ComponentType, agentName string, namespace string, kub | |
|
||
var res *rpc.Client | ||
var lastError error | ||
waitErr := wait.PollImmediate(5*time.Second, 2*time.Minute, func() (bool, error) { | ||
waitErr := wait.PollImmediate(5*time.Second, 3*time.Minute, func() (bool, error) { | ||
res, lastError = rpc.DialHTTP("tcp", fmt.Sprintf("localhost:%d", localAgentPort)) | ||
if lastError != nil { | ||
return false, nil | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this enough time? I ask because the werft job ran for 67 minutes.
https://werft.gitpod-dev.com/job/gitpod-custom-to-stablization-test.17
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it is, because these args pass each test component.