Skip to content

Commit

Permalink
Merge branch 'master' into int-test-hotreload-ignoreErrors
Browse files Browse the repository at this point in the history
  • Loading branch information
dapr-bot committed May 25, 2024
2 parents 84dbb91 + 8e65d49 commit 8fd298c
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 23 deletions.
2 changes: 1 addition & 1 deletion tests/integration/framework/process/daprd/daprd.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ func (d *Daprd) WaitUntilRunning(t *testing.T, ctx context.Context) {
}
defer resp.Body.Close()
return http.StatusNoContent == resp.StatusCode
}, 10*time.Second, 10*time.Millisecond)
}, 30*time.Second, 10*time.Millisecond)
}

func (d *Daprd) WaitUntilAppHealth(t *testing.T, ctx context.Context) {
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func RunIntegrationTests(t *testing.T) {
options := tcase.Setup(t)

t.Logf("setting up test case")
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
ctx, cancel := context.WithTimeout(context.Background(), 45*time.Second)
t.Cleanup(cancel)

framework.Run(t, ctx, options...)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ func (c *components) Setup(t *testing.T) []framework.Option {
func (c *components) Run(t *testing.T, ctx context.Context) {
c.operator.WaitUntilRunning(t, ctx)
c.daprd1.WaitUntilRunning(t, ctx)
c.daprd2.WaitUntilRunning(t, ctx)

client := util.HTTPClient(t)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import (
"fmt"
"io"
"net/http"
"runtime"
"strings"
"testing"
"time"
Expand Down Expand Up @@ -142,7 +141,7 @@ func (h *httpendpoints) Run(t *testing.T, ctx context.Context) {

httpClient := util.HTTPClient(t)

invokeTests := func(t *testing.T, expTLSCode int, assertBody func(t *testing.T, body string), daprd *procdaprd.Daprd) {
invokeTests := func(t *testing.T, expTLSCode int, assertBody func(c *assert.CollectT, body string), daprd *procdaprd.Daprd) {
for _, port := range []int{
h.daprd1.HTTPPort(),
h.daprd2.HTTPPort(),
Expand Down Expand Up @@ -215,37 +214,26 @@ func (h *httpendpoints) Run(t *testing.T, ctx context.Context) {
{url: fmt.Sprintf("http://localhost:%d/v1.0/invoke/mywebsitetls/method/hello", daprd.HTTPPort())},
} {
t.Run(fmt.Sprintf("url %d", i), func(t *testing.T) {
for {
assert.EventuallyWithT(t, func(c *assert.CollectT) {
status, body := doReq(http.MethodGet, ts.url, ts.headers)
assert.Equal(t, expTLSCode, status)
if runtime.GOOS == "windows" &&
strings.Contains(body, "An existing connection was forcibly closed by the remote host.") {
t.Logf("retrying due to: %s", body)
select {
case <-ctx.Done():
assert.Fail(t, "context done")
case <-time.After(time.Millisecond * 100):
continue
}
}
assertBody(t, body)
break
}
assertBody(c, body)
}, time.Second*5, time.Millisecond*10)
})
}
})
}

t.Run("good PKI", func(t *testing.T) {
invokeTests(t, http.StatusOK, func(t *testing.T, body string) {
assert.Equal(t, "ok-TLS", body)
invokeTests(t, http.StatusOK, func(c *assert.CollectT, body string) {
assert.Equal(c, "ok-TLS", body)
}, h.daprd1)
})

t.Run("bad PKI", func(t *testing.T) {
invokeTests(t, http.StatusInternalServerError, func(t *testing.T, body string) {
assert.Contains(t, body, `"errorCode":"ERR_DIRECT_INVOKE"`)
assert.Contains(t, body, "tls: unknown certificate authority")
invokeTests(t, http.StatusInternalServerError, func(c *assert.CollectT, body string) {
assert.Contains(c, body, `"errorCode":"ERR_DIRECT_INVOKE"`)
assert.Contains(c, body, "tls: unknown certificate authority")
}, h.daprd2)
})
}

0 comments on commit 8fd298c

Please sign in to comment.