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

Try to use different sessions in Examples.SessionTest #14

Merged
merged 14 commits into from
Feb 16, 2024

Conversation

pojiro
Copy link
Contributor

@pojiro pojiro commented Feb 15, 2024

@takasehideki

スカウティングディレイ 30 msec の異なるセッションを使うお試しテストを用意したので、 Mac で試してみていただけますか?

単発実行

mix test test/zenohex/examples/session_test.exs

複数回実行

for i in {1..100} ; do mix test test/zenohex/examples/session_test.exs ; done

@pojiro pojiro requested a review from takasehideki February 15, 2024 06:23
@pojiro pojiro marked this pull request as ready for review February 15, 2024 06:24
@pojiro pojiro changed the title Try to use different session in Examples.SessionTest Try to use different sessions in Examples.SessionTest Feb 15, 2024
Copy link
Contributor

@takasehideki takasehideki left a comment

Choose a reason for hiding this comment

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

ありがとうございます!
100回まわしまくりましたが,全件とも問題なくパスしています!

@takasehideki
Copy link
Contributor

これじゃなくて良いのですが,気になったのでメモとして残させてください.
mix test の都度で recompile が走っているように思えるのですが,Rustler的に仕方ない挙動でしょうか?

Compiling 28 files (.ex)
Compiling crate zenohex_nif in release mode (native/zenohex_nif)
    Finished release [optimized] target(s) in 0.11s
Generated zenohex app

@pojiro
Copy link
Contributor Author

pojiro commented Feb 15, 2024

mix test の都度で recompile が走っているように思えるのですが,Rustler的に仕方ない挙動でしょうか?

現状、mix test タスクに alias を作っていて、その中で mix compile --force させているので必ずコンパイルが走るようになっています。
改良できるか考えてみます!

@pojiro pojiro requested a review from takasehideki February 15, 2024 06:46
@takasehideki
Copy link
Contributor

あっ,,, 調子に乗って1000回でやってみたら,277回目の試行がコケてました,,,
確率低すぎだし想定内ではありますが,とりあえず共有しておきます 🙏

=================================================================
HEY, ZENOHEX DEVELOPER. TO REDUCE TESTING TIME,
WE COMPILE WITH API_OPEN_SESSION_DELAY=0
=================================================================
Compiling 28 files (.ex)
Compiling crate zenohex_nif in release mode (native/zenohex_nif)
    Finished release [optimized] target(s) in 0.11s
Generated zenohex app
.

  1) test delete/1 with subscriber (Zenohex.Examples.SessionTest)
     test/zenohex/examples/session_test.exs:39
     Assertion failed, no matching message after 100ms
     The process mailbox is empty.
     code: assert_receive %Sample{key_expr: "key/expression/delete", kind: :delete}
     stacktrace:
       test/zenohex/examples/session_test.exs:52: (test)

.

  2) test get/2 with queryable (Zenohex.Examples.SessionTest)
     test/zenohex/examples/session_test.exs:66
     Assertion failed, no matching message after 100ms
     The process mailbox is empty.
     code: assert_receive %Sample{}
     stacktrace:
       test/zenohex/examples/session_test.exs:83: (test)


Finished in 0.7 seconds (0.00s async, 0.7s sync)
4 tests, 2 failures

Copy link
Contributor

@takasehideki takasehideki left a comment

Choose a reason for hiding this comment

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

totally LGTM!!

@takasehideki takasehideki self-requested a review February 15, 2024 06:53
@pojiro
Copy link
Contributor Author

pojiro commented Feb 16, 2024

@takasehideki 同じセッションと異なるセッションの双方のテストができるように変更しました。

  • 同じセッション:何も指定せずにを走らせる( mix test )とこちら
  • 異なるセッション: USE_DIFFERENT_SESSION ありで走らせる( USE_DIFFERENT_SESSION="" mix test )とこちら

異なるセッションは確率的にコケることがままあることが分かったので、通常の mix test では同じセッションを使うようにしました。
そうはいっても、異なるセッションのテストは必要と思う(Zenoh のバグにも気付ける)ので、それは人間が回し忘れたとしても CI では必ず回るように ci.yaml を更新しました。

image

@pojiro pojiro requested a review from takasehideki February 16, 2024 02:50
@pojiro pojiro merged commit 053cc42 into pojiro/0.2.0-dev Feb 16, 2024
4 checks passed
@pojiro pojiro deleted the pojiro/fix-session-test branch February 16, 2024 04:37
@takasehideki
Copy link
Contributor

@pojiro ただの好みですみません.環境変数は定義 or 未定義よりも値で見るべきかなと思っています.export USE_DIFFERNET_SESSION=1 のときに test-with-two-session が動く感じです( test-with-another-sessions かもですが;;
export USE_DIFFERNET_SESSION= でクリアしたと思っても環境変数としては定義されている状態になっていると認識しています.未定義に戻すには unset USE_DIFFERNET_SESSION すればいいだけですが,,,

@pojiro
Copy link
Contributor Author

pojiro commented Feb 16, 2024

@takasehideki いえ、好み大事です!指摘事項を修正した PR を別で作ります!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants