aboutsummaryrefslogtreecommitdiffstats
path: root/spec
Commit message (Collapse)AuthorAgeFilesLines
* util.human.io: Use tail call in test to get correct line numbersKim Alvefur2023-07-161-1/+1
| | | | | | This is probably not guaranteed to work and might vary with Lua version, but it's good enough for me to get accurate line numbers out of Busted that don't all point to the test() function.
* util.cache: Pass cache itself to eviction callbackKim Alvefur2023-06-301-2/+1
| | | | | | | Simplifies access to the cache without moving code around a lot given the currently common pattern of local some_cache = cache.new(size, function(k,v) end)
* util.cache: Keep eviction candidate if callback resized to make roomKim Alvefur2023-06-301-0/+21
| | | | | Previously either the old or the new values would be rejected, even if the cache was resized to allow more items.
* util.argparse: Add support for repeatable parametersKim Alvefur2022-01-051-0/+5
| | | | These are gathered into arrays
* storagemanager tests: Reorder test data in chronological orderKim Alvefur2021-05-111-13/+13
| | | | | | | Why was the test data not in chronological order? Altho, maybe that was the point? Except for MAM, the data might *not* be in chronological order!
* util.http: Implement parser for RFC 7239 Forwarded headerKim Alvefur2023-06-031-0/+21
| | | | | | | | Standardized and structured replacement for the X-Forwarded-For, X-Forwarded-Proto set of headers. Notably, this allows per-hop protocol information, unlike X-Forwarded-Proto which is always a single value for some reason.
* util.sasl: Add basic tests for OAUTHBEARERKim Alvefur2023-05-261-0/+32
|
* util.jsonschema: Update test suite ignore rulesKim Alvefur2023-05-201-5/+6
| | | | A test case was added in the middle, so all these need to be reordered.
* util.jsonschema: Fix UTF-8ness of 'minLength' and 'maxLength'Kim Alvefur2023-04-231-2/+0
|
* util.jsonschema: Implement 'minContains' and 'maxContains'Kim Alvefur2023-04-231-2/+0
|
* util.jsonschema: Tweak description of disabled testKim Alvefur2023-04-221-1/+1
| | | | | | This doesn't fail because of additionalProperties, looks more like some issue with recursive definitions and util.jsonpointer that I don't want feel like investigating now.
* util.jsonschema: Enable passing IEEE 754 equality testKim Alvefur2023-04-221-1/+0
|
* util.error: Add test for #1805Kim Alvefur2023-04-191-0/+3
| | | | Checks that it doesn't fail on a stanza without <error> tag
* util.human.io: Add parse_duration() method to parse a duration stringMatthew Wild2023-04-071-0/+18
| | | | | Similar logic occurs throughout various modules in the codebase. We might even want a module:get_option_duration()??
* integration tests: Preserve unmocked time.monotonic()Matthew Wild2023-04-061-6/+5
| | | | | | | | | | With monotonic() frozen, timers may fail to trigger. This caused problems after the new util.startup changes that moved the server-started event to a timer. The timer wouldn't trigger, the event didn't fire, and prosody would fail to daemonize. All the tests that depend on specific time behaviour are depending on wall clock time, so only mocking util.time.now() and os.time() fixes those.
* util.fsm: New utility lib for finite state machinesMatthew Wild2022-03-171-0/+250
|
* util.jsonschema: Implement 'dependentSchemas'Kim Alvefur2023-03-261-1/+1
| | | | | If this object key exists then this schema must validate against the current object. Seems useful.
* util.jsonschema: Implement 'dependentRequired'Kim Alvefur2023-03-261-1/+0
| | | | If this field exists, then these fields must also exist.
* util.format: Update tests for serialization changesKim Alvefur2023-03-261-5/+5
|
* scansion: Enable mod_debug_reset during testsMatthew Wild2023-03-231-0/+3
|
* scansion: vcard_temp: Ensure at least one connection is open throughout testMatthew Wild2023-03-231-2/+2
| | | | | | | I plan to introduce logic to "reset" the server between individual tests, which is currently triggered by the lack of any connections. This is the only test that has a point where no clients are connected, and it's not necessary, so I changed it to keep the connection open for the duration of the test.
* scansion: Fix tests failing after addition of pubsub#itemreply config fieldMatthew Wild2023-03-234-0/+51
| | | | This is a newly added field, and we expect to see it in these places now.
* scansion: Fix tests failing due to lack of 'publisher'Matthew Wild2023-03-231-1/+1
| | | | | publisher is no longer included by default in broadcasts, but configured via pubsub#itemreply instead.
* scansion: Add tests for pubsub#itemreply in PEPMatthew Wild2023-03-221-0/+205
|
* scansion: PEP notifications no longer carry 'publisher' by defaultMatthew Wild2023-03-221-3/+3
| | | | | | | | | | | | | Previous behaviour: - publisher was always included in PEP notifications - publisher was never included in get_items requests New behaviour: - publisher is included in both notifications and retrieval if itemreply == publisher - publisher is not ever included if itemreply ~= publisher
* storagemanager: Add keyval+ (combined keyval + map) store typeMatthew Wild2022-09-271-0/+130
| | | | | | | | This combines the two most common store types, which modules often end up opening with both interfaces separately anyway. As well as combining them, I've taken the opportunity to improve some of the method names to make them clearer.
* util.jsonschema: Disable some further new failing testsKim Alvefur2023-03-111-1/+4
| | | | Absolute references, weird fractions, unevaluatedProperties???
* util.jsonschema: Ignore some new tests in test suiteKim Alvefur2023-03-111-1/+4
| | | | These seem to be using absolute URI references, Not Yet Implemented
* util.table: Expand table.move() tests (thanks mutation testing)Matthew Wild2023-03-171-0/+31
|
* util.ip: Tests for truncate()Matthew Wild2023-03-141-0/+22
|
* Merge 0.12->trunkMatthew Wild2023-02-171-3/+50
|\
| * net.http.parser: Fix off-by-one error in chunk parserMatthew Wild2023-02-171-3/+50
| |
* | Merge 0.12->trunkMatthew Wild2023-02-091-3/+3
|\|
| * net.http.parser: Improve handling of responses without content-lengthMatthew Wild2023-02-091-3/+3
| | | | | | | | | | | | This ensures that we support responses without a content-length header, and allow streaming them through the streaming handler interface. An example of such a response would be Server-Sent Events streams.
* | spec: Suppress some harmless luacheck warnings in testsMatthew Wild2023-01-132-0/+3
| |
* | util.paseto: Add support for v3.local tokensMatthew Wild2023-01-131-18/+191
| |
* | util.crypto: Add support for AES-256-CTRMatthew Wild2023-01-131-0/+17
| | | | | | | | This is required by PASETO v3.local
* | util.hashes: Add HKDF-HMAC-SHA256/HKDF-HMAC-SHA384Matthew Wild2023-01-131-0/+38
| | | | | | | | These are needed for PASETO v3.local.
* | util.datamapper: Simplify test schemaKim Alvefur2022-12-201-12/+12
| | | | | | | | | | Don't need the function, more compact to just reference the same reference table.
* | util.hashring: Support associating arbitrary data with nodesMatthew Wild2022-12-021-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In this API, a 'node' is always a simple text string. Sometimes the caller may have a more complex structure representing a node, but the hash ring is really only concerned with the node's name. This API change allows :add_nodes() to take a table of `node_name = value` pairs, as well as the simple array of node names previously accepted. The 'value' of the selected node is returned as a new second result from :get_node(). If no value is passed when a node is added, it defaults to `true` (as before, but this was never previously exposed).
* | util.hashring: tests: don't randomize order - they are written in a ↵Matthew Wild2022-12-021-0/+1
| | | | | | | | sequential style
* | Merge 0.12->trunkMatthew Wild2022-11-041-0/+8
|\|
| * util.json: Accept empty arrays with whitespace (fixes #1782)Matthew Wild2022-11-041-0/+8
| |
* | util.smqueue: Improve testsKim Alvefur2022-10-191-0/+3
| | | | | | | | Result of mutation testing. One mutant remaining.
* | util.jsonpointer: Improve testsKim Alvefur2022-10-191-0/+2
| | | | | | | | | | | | | | | | | | Result of mutation testing Remaining mutants are mostly relating to the math.type() fallback. Another case being that array[#array+1] == array[#array+2] and thus doesn't matter.
* | util.cache: Add some missing test casesMatthew Wild2022-10-131-0/+52
| | | | | | | | Found via mutation testing.
* | util.jid: Add test for invalid domain but valid UTF-8 (thanks jonas)Matthew Wild2022-10-111-0/+1
| |
* | util.jid: Add missing test casesMatthew Wild2022-10-111-0/+40
| | | | | | | | (98% mutant score, single remaining mutant is a string.sub equivalent)
* | util.dbuffer: Add a bunch of missing test casesMatthew Wild2022-10-111-2/+70
| | | | | | | | Found via mutation testing.
* | Merge 0.12->trunkKim Alvefur2022-10-091-7/+13
|\|