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

chore: move redirect test server to rust #6364

Merged
merged 50 commits into from
Jul 4, 2020
Merged
Show file tree
Hide file tree
Changes from 44 commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
47d117c
WIP rewrite tools/http_server.py in Rust
ry Jun 29, 2020
4eee224
Fix test_fetch_with_etag
ry Jun 29, 2020
487ec17
handle xTypeScriptTypes.js
ry Jun 29, 2020
d17cd0e
Fix 053_import_compression WIP
ry Jun 29, 2020
72ebb02
ignore PoisonError in test_server
ry Jun 29, 2020
95da13f
cleanup
ry Jun 29, 2020
2d9f7e2
fix test_fetch_once_with_redirect
ry Jun 29, 2020
a440435
fix test_fetch_with_cafile_brotli
ry Jun 29, 2020
08ef36a
lint
ry Jun 29, 2020
95fd14a
port absolute_redirect_server to rust
ry Jun 29, 2020
4ee39cb
fmt
ry Jun 30, 2020
b2fd03f
bump
ry Jun 30, 2020
8f4829e
fix fetchInitArrayBufferBody
ry Jun 30, 2020
d6488c1
fix fetchInitURLSearchParamsBody
ry Jun 30, 2020
bcb638e
multipart_form_data.txt WIP
ry Jun 30, 2020
1d130cb
fix fetchHeaders
ry Jun 30, 2020
fc7e66d
fix fetchBodyReaderBigBody
ry Jun 30, 2020
0554887
Fix fetchWithRelativeRedirection and fetchWithRedirection
ry Jun 30, 2020
ac32901
fix fetchInitFormDataBinaryFileBody
ry Jun 30, 2020
c60101c
Fix bodyMultipartFormData
ry Jun 30, 2020
afd64d9
WIP remove http_server.py implement HTTPS test server in rust
ry Jun 30, 2020
2cf6b42
fix test_fetch_with_cafile_with_etag
ry Jun 30, 2020
886a222
fix x_deno_warning
ry Jun 30, 2020
1574d0d
Fix type_directives_redirect
ry Jun 30, 2020
8fe47a1
remove unused .header files
ry Jun 30, 2020
8a6d52c
add back std/wasi/testdata/std_fs_file_set_len.rs
ry Jun 30, 2020
8ab9e19
Merge branch 'master' into rust_http_test_server
ry Jun 30, 2020
efbab93
Merge branch 'master' into rust_http_test_server
ry Jul 2, 2020
df97f9e
Merge branch 'master' into rust_http_test_server
ry Jul 2, 2020
502cb9b
debug
bartlomieju Jul 3, 2020
9cd6ad0
reset CI
bartlomieju Jul 3, 2020
fc48686
put server process in mutex
bartlomieju Jul 3, 2020
1887f4a
use new test server in benchmarks
bartlomieju Jul 3, 2020
06b717d
remove debug stmts
bartlomieju Jul 3, 2020
c80a679
lint py
bartlomieju Jul 3, 2020
4fdb0b9
undo bartek's changes to test_util/src/lib.rs
ry Jul 3, 2020
e6d4ecd
disable fast-fail for now
ry Jul 3, 2020
8a15641
wait after kill
ry Jul 3, 2020
d49ee12
Merge remote-tracking branch 'origin/master'
piscisaureus Jul 3, 2020
9b74732
Fix race condition - Linux release/debug now green
piscisaureus Jul 3, 2020
4ba31c3
Some pretty reasonable clean-ups and fixes
piscisaureus Jul 3, 2020
fb6454f
Unrelated but desirable - fewer tokio feature combos in our repo
piscisaureus Jul 4, 2020
08d4175
Would have been nice if this worked but it didn't
piscisaureus Jul 4, 2020
47bf17c
undo berts non-fix changes
ry Jul 4, 2020
685c30c
all servers should be included in the future::join
ry Jul 4, 2020
b1560e9
try fixing benchmark
ry Jul 4, 2020
69915d2
undo fail-fast thing
ry Jul 4, 2020
35122ee
test_server only needs to be running for run_exec_time
ry Jul 4, 2020
bbb0ccb
less is more
piscisaureus Jul 4, 2020
f3da27a
replace http_server.py in various comments
ry Jul 4, 2020
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
9 changes: 1 addition & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,7 @@ jobs:
- os: ubuntu-16.04
kind: lint

# Always run master branch builds to completion. This allows the cache to
# stay mostly up-to-date in situations where a single job fails due to
# e.g. a flaky test.
# Don't fast-fail on tag build because publishing binaries shouldn't be
# prevented if 'cargo publish' fails (which can be a false negative).
fail-fast:
${{ github.event_name == 'pull_request' || (github.ref !=
'refs/heads/master' && !startsWith(github.ref, 'refs/tags/')) }}
fail-fast: false

env:
CARGO_INCREMENTAL: 0
Expand Down
51 changes: 45 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions cli/tests/053_import_compression/brotli.header

This file was deleted.

3 changes: 0 additions & 3 deletions cli/tests/053_import_compression/gziped.header

This file was deleted.

2 changes: 1 addition & 1 deletion cli/tests/unit/body_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ unitTest(
{ perms: { net: true } },
async function bodyMultipartFormData(): Promise<void> {
const response = await fetch(
"http://localhost:4545/cli/tests/subdir/multipart_form_data.txt"
"http://localhost:4545/multipart_form_data.txt"
);
const text = await response.text();

Expand Down
50 changes: 21 additions & 29 deletions cli/tests/unit/fetch_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ unitTest({ perms: { net: true } }, async function fetchHeaders(): Promise<
const response = await fetch("http://localhost:4545/cli/tests/fixture.json");
const headers = response.headers;
assertEquals(headers.get("Content-Type"), "application/json");
assert(headers.get("Server")!.startsWith("SimpleHTTP"));
const _json = await response.json();
});

Expand Down Expand Up @@ -162,13 +161,10 @@ unitTest(
{ perms: { net: true } },
async function fetchBodyReaderBigBody(): Promise<void> {
const data = "a".repeat(10 << 10); // 10mb
const response = await fetch(
"http://localhost:4545/cli/tests/echo_server",
{
method: "POST",
body: data,
}
);
const response = await fetch("http://localhost:4545/echo_server", {
method: "POST",
body: data,
});
assert(response.body !== null);
const reader = await response.body.getReader();
let total = 0;
Expand Down Expand Up @@ -210,7 +206,7 @@ unitTest(
{ perms: { net: true } },
async function fetchMultipartFormDataSuccess(): Promise<void> {
const response = await fetch(
"http://localhost:4545/cli/tests/subdir/multipart_form_data.txt"
"http://localhost:4545/multipart_form_data.txt"
);
const formData = await response.formData();
assert(formData.has("field_1"));
Expand Down Expand Up @@ -315,12 +311,12 @@ unitTest(
perms: { net: true },
},
async function fetchWithRedirection(): Promise<void> {
const response = await fetch("http://localhost:4546/"); // will redirect to http://localhost:4545/
const response = await fetch("http://localhost:4546/README.md");
assertEquals(response.status, 200);
assertEquals(response.statusText, "OK");
assertEquals(response.url, "http://localhost:4545/");
assertEquals(response.url, "http://localhost:4545/README.md");
const body = await response.text();
assert(body.includes("<title>Directory listing for /</title>"));
assert(body.includes("Deno"));
}
);

Expand All @@ -329,11 +325,13 @@ unitTest(
perms: { net: true },
},
async function fetchWithRelativeRedirection(): Promise<void> {
const response = await fetch("http://localhost:4545/cli/tests"); // will redirect to /cli/tests/
const response = await fetch(
"http://localhost:4545/cli/tests/001_hello.js"
);
assertEquals(response.status, 200);
assertEquals(response.statusText, "OK");
const body = await response.text();
assert(body.includes("<title>Directory listing for /cli/tests/</title>"));
assert(body.includes("Hello"));
}
);

Expand Down Expand Up @@ -769,13 +767,10 @@ unitTest(
{ perms: { net: true } },
async function fetchBodyReaderWithCancelAndNewReader(): Promise<void> {
const data = "a".repeat(1 << 10);
const response = await fetch(
"http://localhost:4545/cli/tests/echo_server",
{
method: "POST",
body: data,
}
);
const response = await fetch("http://localhost:4545/echo_server", {
method: "POST",
body: data,
});
assert(response.body !== null);
const firstReader = await response.body.getReader();

Expand All @@ -801,13 +796,10 @@ unitTest(
async function fetchBodyReaderWithReadCancelAndNewReader(): Promise<void> {
const data = "a".repeat(1 << 10);

const response = await fetch(
"http://localhost:4545/cli/tests/echo_server",
{
method: "POST",
body: data,
}
);
const response = await fetch("http://localhost:4545/echo_server", {
method: "POST",
body: data,
});
assert(response.body !== null);
const firstReader = await response.body.getReader();

Expand Down Expand Up @@ -848,7 +840,7 @@ unitTest(

for (const status of nullBodyStatus) {
const headers = new Headers([["x-status", String(status)]]);
const res = await fetch("http://localhost:4545/cli/tests/echo_server", {
const res = await fetch("http://localhost:4545/echo_server", {
body: "deno",
method: "POST",
headers,
Expand Down
2 changes: 0 additions & 2 deletions cli/tests/x_deno_warning.js.header

This file was deleted.

8 changes: 7 additions & 1 deletion test_util/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,16 @@ authors = ["the Deno authors"]
edition = "2018"
publish = false

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[[bin]]
name = "test_server"
path = "src/test_server.rs"

[dependencies]
tokio = { version = "0.2.21", features = ["rt-core", "tcp", "udp", "uds", "process", "fs", "blocking", "sync", "io-std", "macros", "time"] }
futures = { version = "0.3.5", features = ["compat", "io-compat"] }
bytes = "0.5.5"
lazy_static = "1.4.0"
os_pipe = "0.9.2"
regex = "1.3.9"
tempfile = "3.1.0"
warp = { version = "0.2.3", features = ["tls"] }
Loading