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

[LRS-83] Empty statement batches #95

Merged
merged 5 commits into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions .clj-kondo/config.edn
milt marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,7 @@ npm-debug.log
package.json
*.log
/out_test
.calva/
.clj-kondo/*
!.clj-kondo/config.edn
.lsp/
27 changes: 27 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,33 @@

## Unreleased

## [1.2.21] - 2024-09-24
- Update xapi-schema to 1.4.0 to support empty statement batch POSTs
- Update GitHub actions to resolve Node deprecation warnings

## [1.2.20] - 2024-07-25
- Fix error in `/xapi/statements` POST OpenAPI spec

## [1.2.19] - 2024-07-18
- Implement OpenAPI annotations

## [1.2.18] - 2024-05-20
- Update xapi-schema to 1.3.0
- Address Babel vulnerability

## [1.2.17] - 2024-02-16
- Changed Clojars deploy action

## [1.2.16] - 2023-11-22
- Support Attachment and Document Scanning

## [1.2.15] - 2023-02-22
- CVE-2023-24998: Update commons-fileupload to 1.5
- Update package-lock for qs vulnerability

## [1.2.14] - 2022-11-16
- Exclude msgpack from dependencies to clear CVE-2022-41719

## [1.2.13] - 2022-10-24
- Update GitHub CI and CD to remove deprecation warnings

Expand Down
2 changes: 1 addition & 1 deletion deps.edn
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{org.clojure/clojure {:mvn/version "1.10.1"}
org.clojure/clojurescript {:mvn/version "1.10.741"}
org.clojure/core.async {:mvn/version "1.5.648"}
com.yetanalytics/xapi-schema {:mvn/version "1.3.0"
com.yetanalytics/xapi-schema {:mvn/version "1.4.0"
:exclusions [org.clojure/clojurescript]}
com.yetanalytics/gen-openapi {:mvn/version "0.0.5"}
cheshire/cheshire {:mvn/version "5.10.1"}
Expand Down
26 changes: 19 additions & 7 deletions src/test/com/yetanalytics/lrs_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,25 @@
lrs/authorize
lrs/authorize-async])

(def auth-id
{:auth {:no-op {}}
:prefix ""
:scopes #{:scope/all}
:agent {"mbox" "mailto:lrs@yetanalytics.io"}})

(deftest empty-store-test
(let [lrs (doto (mem/new-lrs {:statements-result-max 100})
(lrs/store-statements auth-id [] []))
ret-statements (get-in (lrs/get-statements lrs
auth-id
{:limit 100}
#{"en-US"})
[:statement-result :statements])]
(is (s/valid? ::xs/statements ret-statements))
(is (empty? ret-statements))))

(deftest query-test
(let [auth-id {:auth {:no-op {}}
:prefix ""
:scopes #{:scope/all}
:agent {"mbox" "mailto:lrs@yetanalytics.io"}}
;; The serialized state shouldn't be used for this, because we're
(let [;; The serialized state shouldn't be used for this, because we're
;; changing things around.
;; The datasim data is not currently normalized, but only happens at a
;; max precision of 1 ms. That's timestamps though, looks like we have
Expand All @@ -75,8 +88,7 @@
[:statement-result :statements]))
ret-statements (get-ss {:limit 100})]
(testing (format "%s valid return statements?" (count ret-statements))
(is (s/valid? (s/every ::xs/statement)
ret-statements)))
(is (s/valid? ::xs/statements ret-statements)))
(testing "preserved?"
(is (= (dissoc (first ret-statements)
"authority"
Expand Down
Loading