fix(tests): complete migration to content-based stubbing in functional tests
All checks were successful
CI Code / Check spelling (pull_request) Successful in 20s
CI Code / Check coding style (pull_request) Successful in 34s
CI Code / Linux (ubuntu) (pull_request) Successful in 1h7m38s
CI Code / Linux (debian) (pull_request) Successful in 1h7m54s
CI Code / Linux (arch) (pull_request) Successful in 1h8m1s
All checks were successful
CI Code / Check spelling (pull_request) Successful in 20s
CI Code / Check coding style (pull_request) Successful in 34s
CI Code / Linux (ubuntu) (pull_request) Successful in 1h7m38s
CI Code / Linux (debian) (pull_request) Successful in 1h7m54s
CI Code / Linux (arch) (pull_request) Successful in 1h8m1s
This commit is contained in:
@@ -146,7 +146,7 @@ Historically the functional test suite relied on stabber's id based helpers like
|
||||
* Reordering internal requests produced hard-to-debug race conditions when an `id` no longer matched.
|
||||
* Parallel additions of new features could shift which stanzas received a given id causing unrelated test failures.
|
||||
|
||||
We are incrementally migrating to content based stubbing using direct sends (`stbbr_send`) and query hooks (`stbbr_for_query`). Instead of tying a response to a predicted id we now send the required server stanzas explicitly after initiating actions. Example (see `tests/functionaltests/proftest.c`):
|
||||
We have migrated to content based stubbing using direct sends (`stbbr_send`) and query hooks (`stbbr_for_query`). Instead of tying a response to a predicted id we now send the required server stanzas explicitly after initiating actions. Example (see `tests/functionaltests/proftest.c`):
|
||||
|
||||
```c
|
||||
// Old brittle approach
|
||||
@@ -170,5 +170,5 @@ Guidelines when writing new functional tests:
|
||||
4. Keep assertions tolerant of ordering when possible; rely on `prof_output_regex()` matches rather than hard-coded positions.
|
||||
5. If timing flakiness appears, temporarily raise `prof_timeout()` around the critical expectation and reset it immediately afterwards.
|
||||
|
||||
During the migration it's acceptable for a test file to mix old and new styles; opportunistically refactor brittle sections when touching a test for other reasons.
|
||||
The migration from `stbbr_for_id` is complete. All functional tests now use content-based stubbing. When adding new tests, follow the guidelines above.
|
||||
|
||||
|
||||
@@ -45,7 +45,6 @@ ARCH="$(uname | tr '[:upper:]' '[:lower:]')"
|
||||
case "$ARCH" in
|
||||
linux*)
|
||||
# Reduced set of configurations for faster CI
|
||||
# Uncomment additional configurations for more thorough testing
|
||||
tests=(
|
||||
# 1. Full build (all features enabled)
|
||||
"--enable-notifications --enable-icons-and-clipboard --enable-otr --enable-pgp
|
||||
@@ -66,7 +65,6 @@ case "$ARCH" in
|
||||
;;
|
||||
darwin*)
|
||||
# Reduced set of configurations for faster CI
|
||||
# Uncomment additional configurations for more thorough testing
|
||||
tests=(
|
||||
# 1. Full build (all features enabled)
|
||||
"--enable-notifications --enable-icons-and-clipboard --enable-otr --enable-pgp
|
||||
@@ -93,7 +91,6 @@ case "$ARCH" in
|
||||
CC="egcc -std=gnu99 -fexec-charset=UTF-8"
|
||||
|
||||
# Reduced set of configurations for faster CI
|
||||
# Uncomment additional configurations for more thorough testing
|
||||
tests=(
|
||||
# 1. Full build (all features enabled)
|
||||
"--enable-notifications --enable-icons-and-clipboard --enable-otr --enable-pgp
|
||||
|
||||
@@ -30,8 +30,9 @@ send_receipt_request(void **state)
|
||||
|
||||
prof_connect();
|
||||
|
||||
stbbr_for_id("prof_caps_4",
|
||||
"<iq from='buddy1@localhost/laptop' to='stabber@localhost' id='prof_caps_4' type='result'>"
|
||||
// Register disco#info response for capabilities query (receipts support)
|
||||
stbbr_for_query("http://jabber.org/protocol/disco#info",
|
||||
"<iq from='buddy1@localhost/laptop' to='stabber@localhost' id='*' type='result'>"
|
||||
"<query xmlns='http://jabber.org/protocol/disco#info' node='http://profanity-im.github.io#hAkb1xZdJV9BQpgGNw8zG5Xsals='>"
|
||||
"<identity category='client' name='Profanity 0.5.0' type='console'/>"
|
||||
"<feature var='urn:xmpp:receipts'/>"
|
||||
|
||||
Reference in New Issue
Block a user