mirror of
https://github.com/kubevela/kubevela.git
synced 2026-02-14 10:00:06 +00:00
Fix: mc flaky e2e test (#5661)
* Fix: mc flaky e2e test Signed-off-by: Somefive <yd219913@alibaba-inc.com> * Fix: add time for workflow rollback Signed-off-by: Somefive <yd219913@alibaba-inc.com> * Fix: load-test flaky Signed-off-by: Somefive <yd219913@alibaba-inc.com> --------- Signed-off-by: Somefive <yd219913@alibaba-inc.com>
This commit is contained in:
@@ -19,6 +19,7 @@ package utils
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"os"
|
||||
"testing"
|
||||
"time"
|
||||
@@ -27,18 +28,15 @@ import (
|
||||
)
|
||||
|
||||
func TestReadRemoteOrLocalPath(t *testing.T) {
|
||||
go func() {
|
||||
svr := http.NewServeMux()
|
||||
svr.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
||||
fmt.Fprintf(w, `{"Outputs":{"Chinese":"输出"}}`)
|
||||
})
|
||||
http.ListenAndServe(":65503", svr)
|
||||
}()
|
||||
svr := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
_, _ = fmt.Fprintf(w, `{"Outputs":{"Chinese":"输出"}}`)
|
||||
}))
|
||||
defer func() { svr.Close() }()
|
||||
time.Sleep(time.Millisecond)
|
||||
|
||||
_, err := ReadRemoteOrLocalPath("http://127.0.0.1:65503", false)
|
||||
_, err := ReadRemoteOrLocalPath(svr.URL, false)
|
||||
assert.NoError(t, err)
|
||||
_, err = ReadRemoteOrLocalPath("http://127.0.0.1:65503", true)
|
||||
_, err = ReadRemoteOrLocalPath(svr.URL, true)
|
||||
assert.NoError(t, err)
|
||||
_, err = ReadRemoteOrLocalPath("vela.json", false)
|
||||
assert.NoError(t, err)
|
||||
|
||||
@@ -65,7 +65,9 @@ var _ = Describe("Test multicluster standalone scenario", func() {
|
||||
|
||||
applyFile := func(filename string) {
|
||||
un := readFile(filename)
|
||||
Expect(k8sClient.Create(context.Background(), un)).Should(Succeed())
|
||||
Eventually(func(g Gomega) {
|
||||
g.Expect(k8sClient.Create(context.Background(), un)).Should(Succeed())
|
||||
}).WithTimeout(10 * time.Second).WithPolling(2 * time.Second).Should(Succeed())
|
||||
}
|
||||
|
||||
BeforeEach(func() {
|
||||
@@ -300,7 +302,7 @@ var _ = Describe("Test multicluster standalone scenario", func() {
|
||||
revs, err := application.GetSortedAppRevisions(hubCtx, k8sClient, app.Name, namespace)
|
||||
g.Expect(err).Should(Succeed())
|
||||
g.Expect(len(revs)).Should(Equal(1))
|
||||
}).WithTimeout(10 * time.Second).Should(Succeed())
|
||||
}).WithTimeout(30 * time.Second).WithPolling(2 * time.Second).Should(Succeed())
|
||||
})
|
||||
|
||||
It("Test large application parallel apply and delete", func() {
|
||||
|
||||
Reference in New Issue
Block a user