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

Add retry in templates to wait realtime notifications #161

Merged
merged 45 commits into from
Nov 30, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
a677a3d
[realtime tests] add sleep to wait notifications
Aschen Nov 23, 2018
0b0a6cf
[realtime tests] extract sleep from the code snippets
Aschen Nov 23, 2018
21bf4a7
[realtime tests] remove sleep in cpp snippet
Aschen Nov 23, 2018
e32e360
[realtime tests] increase sleep for js
Aschen Nov 23, 2018
91857f3
[realtime tests] use retry in cpp template
Aschen Nov 23, 2018
4cdc08a
[realtime tests] use retry in java template
Aschen Nov 23, 2018
24a87c5
[realtime tests] use retry in go template
Aschen Nov 23, 2018
46b7010
[realtime tests] use retry in js template
Aschen Nov 23, 2018
720997d
[realtime tests] nitpicking
Aschen Nov 23, 2018
706ea6c
[realtime tests] prevent infinite loops
Aschen Nov 23, 2018
cb9253a
[realtime tests] exit with non-zero code when timeout in go
Aschen Nov 23, 2018
9639cd2
[realtime tests] add sleep to wait notifications
Aschen Nov 23, 2018
35b338d
[realtime tests] extract sleep from the code snippets
Aschen Nov 23, 2018
1199b28
[realtime tests] remove sleep in cpp snippet
Aschen Nov 23, 2018
6ca00a9
[realtime tests] increase sleep for js
Aschen Nov 23, 2018
a555b16
[realtime tests] use retry in cpp template
Aschen Nov 23, 2018
89700bf
[realtime tests] use retry in java template
Aschen Nov 23, 2018
948490f
[realtime tests] use retry in go template
Aschen Nov 23, 2018
37efd20
[realtime tests] use retry in js template
Aschen Nov 23, 2018
007bed9
[realtime tests] nitpicking
Aschen Nov 23, 2018
41d634c
[realtime tests] prevent infinite loops
Aschen Nov 23, 2018
7cd127d
[realtime tests] exit with non-zero code when timeout in go
Aschen Nov 23, 2018
8ea341f
Merge branch 'fix-realtime-tests' of github.com:kuzzleio/documentatio…
Aschen Nov 27, 2018
4b5e07e
[realtime tests] fix js realtime
Aschen Nov 27, 2018
c9ebf6d
[realtime tests] fix js realtime
Aschen Nov 27, 2018
851e07f
[c++] update templates to the latest SDK version
scottinet Nov 28, 2018
c875266
[templates] C++: kuzzle->connect now throws
scottinet Nov 28, 2018
0d19c20
[cleanup] revert type change
scottinet Nov 28, 2018
e944bba
[c++] upgrade SDK install to the latest changes
scottinet Nov 28, 2018
2a8dcf9
Merge remote-tracking branch 'origin/upgrade-cpp-templates' into fix-…
scottinet Nov 28, 2018
c181328
Merge remote-tracking branch 'origin/master' into fix-realtime-tests
scottinet Nov 28, 2018
f6489d2
[c++] upgrade code snippets
scottinet Nov 28, 2018
154cce2
[java] upgrade templates to the new kuzzle constructor
scottinet Nov 28, 2018
6559596
Merge remote-tracking branch 'origin/upgrade-cpp-templates' into fix-…
scottinet Nov 28, 2018
94bbb9c
[realtime] upgrade templates to the latest kuzzle constructor
scottinet Nov 28, 2018
5a67369
[realtime] wait for 30s before throwing a timeout
scottinet Nov 28, 2018
9e64df3
[templates] realtime: timeout after 30s
scottinet Nov 29, 2018
de6e9d3
[realtime] JS template: exit even if the event loop is not empty
scottinet Nov 29, 2018
ea3e090
[realtime] JS: stricter tests + fix explanation
scottinet Nov 29, 2018
f20db37
[snippets] multi-snippets wrongly check column precedence
scottinet Nov 29, 2018
7645862
[realtime] stricter tests + snippet fixes
scottinet Nov 29, 2018
f8f8e20
[realtime] stabilize realtime tests
scottinet Nov 29, 2018
ee3b481
[templates] C++: getPort() is now only accessible through the Protoco…
scottinet Nov 30, 2018
3b3306c
Merge remote-tracking branch 'origin/master' into fix-realtime-tests
scottinet Nov 30, 2018
ee6d075
[java] fix user notifications snippet
scottinet Nov 30, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion test/templates/realtime.tpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ int main() {

[snippet-code]

while (is_empty(&cout_copy)) {
for (size_t i = 20; i > 0 && is_empty(&cout_copy); --i) {
usleep(200);
}

Expand Down
5 changes: 5 additions & 0 deletions test/templates/realtime.tpl.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ func main() {

[snippet-code]

go func() {
time.Sleep(4 * time.Second)
os.Exit(0)
scottinet marked this conversation as resolved.
Show resolved Hide resolved
}()

b := make([]byte, 4096)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should make sure that the buffer has been completely emptied and printed before stopping the snippet: 4k may not be large enough

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I pick this value that should be enough because in the snippets we always print a string with a fixed length

n, _ := r.Read(b)
scottinet marked this conversation as resolved.
Show resolved Hide resolved

Expand Down
2 changes: 1 addition & 1 deletion test/templates/realtime.tpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public static void main(String[] args) {

[snippet-code]

while (baos.size() == 0) {
for (int i = 20; i > 0 && baos.size() == 0; --i) {
try {
Thread.sleep(200);
} catch (InterruptedException e) {
Expand Down
8 changes: 5 additions & 3 deletions test/templates/realtime.tpl.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,11 @@ function sleep (ms) {
};

[snippet-code] finally {
while (outputs.length <= 0) {
await sleep(200);
}
(async () => {
for (let i = 20; i > 0 && outputs.length <= 0; --i) {
await sleep(200);
}
})();

console.log = consoleLog;
console.log(...outputs);
Expand Down