Merge branch 'main' into cli
Some checks failed
/ node-check (pull_request) Successful in 3s
/ prettier (pull_request) Successful in 27s
/ tests (pull_request) Failing after 33s
/ boot (pull_request) Successful in 28s

This commit is contained in:
9pfs 2024-06-19 22:40:16 +00:00
commit 1e14211177
Signed by: 9pfs
SSH key fingerprint: SHA256:TOcGxMQCfy4VvRM8AzgXErKXdkAtaTcpGXgYMpyoJoY
5 changed files with 26 additions and 4 deletions

View file

@ -21,7 +21,7 @@ jobs:
- run: apt-get install -y postgresql-client
- run: NODE_ENV=production npm ci
- run: cat migrations/*.sql|PGPASSWORD=postgres psql -h test-db -U postgres test-db
- run: node tests/index.js
- run: DB_CONNECTION_STRING=postgres://postgres:postgres@test-db/test-db node tests/index.js
prettier:
runs-on: docker
steps:
@ -35,12 +35,18 @@ jobs:
steps:
- uses: actions/checkout@v3
- id: check
run: for a in `find|grep -v node_modules|grep '\.js$'`; do node --check $a && echo "$a OK"; done
run: for a in `find|grep -v node_modules|grep '\.js$'`; do node --check $a || exit 1; echo "$a OK"; done
boot:
runs-on: docker
steps:
- uses: actions/checkout@v3
- id: dependencies
run: NODE_ENV=production npm ci
- id: boot-test
- id: boot-test-1
run: TEST_MODE=boot LISTEN_PATH=/tmp/webserver.sock node index.js
- id: boot-test-prepare
run: mkdir -p /run/user/2123/countify-dev
- id: boot-test-dev
run: TEST_MODE=boot node index.js
- id: boot-test-prod
run: TEST_MODE=boot NODE_ENV=production node index.js

3
.vscode/settings.json vendored Normal file
View file

@ -0,0 +1,3 @@
{
"editor.tabSize": 2
}

View file

@ -132,7 +132,7 @@ app.get("/stats", function (req, res) {
return res.json(stats);
});
const listen_path = process.env?.LISTEN_PATH;
var listen_path = process.env?.LISTEN_PATH;
if (listen_path == null)
listen_path =
process.env?.NODE_ENV == "production"

View file

@ -1,4 +1,5 @@
// Each test should be imported here.
import "./db-sanity.js";
import "./validation.js";
// This should be the last line.
console.log("Tests successful.");

12
tests/validation.js Normal file
View file

@ -0,0 +1,12 @@
import { counter_create } from "../utils.js";
import assert from "assert";
assert.rejects(async () => {
await counter_create({
key: "e",
value: 1,
enable_reset: false,
update_lowerbound: 0,
update_upperbound: 0,
namespace: "test000",
});
});