Skip to content

Commit

Permalink
make the times higher because CI is slower
Browse files Browse the repository at this point in the history
  • Loading branch information
JT Archie committed Nov 1, 2018
1 parent ae98e50 commit f77a913
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions network/progress_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ var _ = Describe("ProgressClient", func() {
_, err := ioutil.ReadAll(req.Body)
Expect(err).NotTo(HaveOccurred())

time.Sleep(10 * time.Millisecond)
time.Sleep(20 * time.Millisecond)

return &http.Response{
StatusCode: http.StatusOK,
Expand All @@ -87,7 +87,7 @@ var _ = Describe("ProgressClient", func() {
req, err := http.NewRequest("POST", "/some/endpoint", strings.NewReader("some content"))
Expect(err).NotTo(HaveOccurred())

req = req.WithContext(context.WithValue(req.Context(), "polling-interval", time.Millisecond))
req = req.WithContext(context.WithValue(req.Context(), "polling-interval", 10*time.Millisecond))

_, err = progressClient.Do(req)
Expect(err).NotTo(HaveOccurred())
Expand All @@ -97,11 +97,9 @@ var _ = Describe("ProgressClient", func() {
})

By("writing to the live log writer", func() {
Expect(liveWriter.WriteCallCount()).To(BeNumerically("~", 10, 1))
Expect(string(liveWriter.WriteArgsForCall(0))).To(ContainSubstring("1ms elapsed"))
Expect(string(liveWriter.WriteArgsForCall(1))).To(ContainSubstring("2ms elapsed"))
Expect(string(liveWriter.WriteArgsForCall(2))).To(ContainSubstring("3ms elapsed"))
Expect(string(liveWriter.WriteArgsForCall(3))).To(ContainSubstring("4ms elapsed"))
Expect(liveWriter.WriteCallCount()).To(BeNumerically("~", 3, 1))
Expect(string(liveWriter.WriteArgsForCall(0))).To(ContainSubstring("10ms elapsed"))
Expect(string(liveWriter.WriteArgsForCall(1))).To(ContainSubstring("20ms elapsed"))
})

By("flushing the live log writer", func() {
Expand Down Expand Up @@ -149,7 +147,7 @@ var _ = Describe("ProgressClient", func() {
ioutil.ReadAll(req.Body)
defer req.Body.Close()

time.Sleep(5 * time.Millisecond)
time.Sleep(50 * time.Millisecond)

return &http.Response{
StatusCode: http.StatusOK,
Expand All @@ -162,15 +160,15 @@ var _ = Describe("ProgressClient", func() {
req, err := http.NewRequest("POST", "/some/endpoint", strings.NewReader("some content"))
Expect(err).NotTo(HaveOccurred())

req = req.WithContext(context.WithValue(req.Context(), "polling-interval", 2*time.Millisecond))
req = req.WithContext(context.WithValue(req.Context(), "polling-interval", 20*time.Millisecond))

_, err = progressClient.Do(req)
Expect(err).NotTo(HaveOccurred())

Expect(liveWriter.StartCallCount()).To(Equal(1))
Expect(liveWriter.WriteCallCount()).To(BeNumerically("~", 2, 1))
Expect(string(liveWriter.WriteArgsForCall(0))).To(ContainSubstring("2ms elapsed"))
Expect(string(liveWriter.WriteArgsForCall(1))).To(ContainSubstring("4ms elapsed"))
Expect(string(liveWriter.WriteArgsForCall(0))).To(ContainSubstring("20ms elapsed"))
Expect(string(liveWriter.WriteArgsForCall(1))).To(ContainSubstring("40ms elapsed"))
Expect(liveWriter.StopCallCount()).To(Equal(1))
})
})
Expand Down

0 comments on commit f77a913

Please sign in to comment.