Choose test server port in a range
To fix random test failures
This commit is contained in:
parent
bc885f4612
commit
9c8aa11dea
5 changed files with 28 additions and 7 deletions
1
config/run.flags
Normal file
1
config/run.flags
Normal file
|
@ -0,0 +1 @@
|
|||
--allow-read --allow-net --location https://rs.thunderk.net/
|
1
config/test.flags
Normal file
1
config/test.flags
Normal file
|
@ -0,0 +1 @@
|
|||
--allow-read --allow-net --location https://test.rs.thunderk.net/
|
19
run
Executable file
19
run
Executable file
|
@ -0,0 +1,19 @@
|
|||
#!/bin/sh
|
||||
# Simplified run tool for deno commands
|
||||
|
||||
if test $# -eq 0
|
||||
then
|
||||
echo "Usage: $0 [file or command]"
|
||||
exit 1
|
||||
elif echo $1 | grep -q '.*.ts'
|
||||
then
|
||||
denocmd=run
|
||||
denoargs=$1
|
||||
shift
|
||||
else
|
||||
denocmd=$1
|
||||
shift
|
||||
fi
|
||||
|
||||
denoargs="$(cat config/$denocmd.flags 2> /dev/null) $denoargs $@"
|
||||
exec deno $denocmd $denoargs
|
|
@ -1,8 +1,8 @@
|
|||
#!/usr/bin/env -S deno run --allow-read --allow-net
|
||||
import { getLocalStorage } from "./mod.ts";
|
||||
#!./run
|
||||
import { KeyValueStorage } from "./basic.ts";
|
||||
import { HEADER_REPLYIER, HEADER_REQUESTER } from "./remote.ts";
|
||||
import { json, opine, opineCors, readAll } from "./deps.ts";
|
||||
import { getLocalStorage } from "./mod.ts";
|
||||
import { HEADER_REPLYIER, HEADER_REQUESTER } from "./remote.ts";
|
||||
|
||||
const PORT = 5001;
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
import { KeyValueStorage, MemoryStorage } from "./basic.ts";
|
||||
import { expect } from "https://code.thunderk.net/typescript/devtools/raw/1.2.2/testing.ts";
|
||||
import { getAvailablePort } from "https://deno.land/x/port@1.0.0/mod.ts";
|
||||
import { KeyValueStorage, MemoryStorage } from "./basic.ts";
|
||||
import { startRestServer } from "./server.ts";
|
||||
export {
|
||||
describe,
|
||||
expect,
|
||||
it,
|
||||
} from "https://code.thunderk.net/typescript/devtools/raw/1.2.2/testing.ts";
|
||||
import { getAvailablePort } from "https://deno.land/x/port@1.0.0/mod.ts";
|
||||
import { startRestServer } from "./server.ts";
|
||||
|
||||
/**
|
||||
* Basic high-level test suite for any kind storage
|
||||
|
@ -43,7 +43,7 @@ export async function disableLocalStorage(
|
|||
export async function runTestServer(
|
||||
body: (url: string) => Promise<void>,
|
||||
): Promise<void> {
|
||||
const port = await getAvailablePort();
|
||||
const port = await getAvailablePort({ port: { start: 3000, end: 30000 } });
|
||||
if (!port) {
|
||||
throw new Error("No port available for test server");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue