Skip to content

Commit

Permalink
Build Daphne for tests.
Browse files Browse the repository at this point in the history
Now, rather than using a pre-compiled version of Daphne that we build
into a conatiner using our own custom build process, we build & use the
Daphne test container defined in the Daphne repository itself.
  • Loading branch information
branlwyd committed Aug 24, 2022
1 parent a348661 commit e4eba0c
Show file tree
Hide file tree
Showing 9 changed files with 61 additions and 1,615 deletions.
3 changes: 2 additions & 1 deletion Cargo.lock

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

3 changes: 2 additions & 1 deletion monolithic_integration_test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ kube-openssl = ["kube/openssl-tls"]

[dependencies]
backoff = { version = "0.4", features = ["tokio"] }
daphne = { git = "https://github.com/cloudflare/daphne", rev = "2f042113af8df7527c1761490cea40139952ad5e", optional = true } # Match this to the compiled version referenced in README.md.
daphne = { git = "https://github.com/cloudflare/daphne", rev = "6228556c7b87a7fe85e414a3186a2511407896f0", optional = true } # Match this to the version referenced in README.md.
futures = "0.3.23"
hex = { version = "0.4", optional = true }
interop_binaries = { path = "../interop_binaries", features = ["testcontainer"] }
Expand Down Expand Up @@ -50,3 +50,4 @@ prio = "0.8.2"

[build-dependencies]
build_script_utils = { path = "../build_script_utils", optional = true }
tempfile = "3"
9 changes: 0 additions & 9 deletions monolithic_integration_test/Dockerfile.test_daphne

This file was deleted.

65 changes: 9 additions & 56 deletions monolithic_integration_test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,70 +3,23 @@
## Daphne

The [Daphne](https://github.com/cloudflare/daphne) testing functionality is implemented by running a
WASM-compiled version of Daphne inside [miniflare](https://miniflare.dev), inside a container. The
compiled artifacts are included in `artifacts/daphne_compiled`; the test container is built by the
build script & included in necessary test binaries which know how to load the image into Docker
themselves.
compiled version of Daphne inside a container. The test container is built by this package's build
script based on the test Dockerfile in the Daphne repository; the test container is included in
necessary test binaries which know how to load the image into Docker themselves.

The compiled Daphne is from commit [`2f042113af8df7527c1761490cea40139952ad5e`](
https://github.com/cloudflare/daphne/commit/2f042113af8df7527c1761490cea40139952ad5e).
Daphne is compiled from commit [`6228556c7b87a7fe85e414a3186a2511407896f0`](
https://github.com/cloudflare/daphne/commit/6228556c7b87a7fe85e414a3186a2511407896f0).

### Running Daphne integration tests

First, make sure your workstation is set up per the instructions in the repository root's README.md.

Once `docker` is installed, simply run `cargo test` to run the Daphne integration tests.
Then, run `cargo test` to run the Daphne integration tests.

### Updating the version of Daphne under test

Compiling a new version of Daphne requires having [wrangler](https://github.com/cloudflare/wrangler)
installed.

To update the version of Daphne in use:

1. Update `Cargo.toml` in this directory to reference the new version of Daphne.
1. Check out the [Daphne repository](https://github.com/cloudflare/daphne) at the desired version,
and switch into the repository's `daphne_worker_test` directory.
1. Run `worker-build`; this will compile Daphne to WASM & place the results into the `build`
directory.
1. Replace the content of `monolithic_integration_test/artifacts/daphne_compiled` in the Janus
repository with the content of `daphne_worker_test/build/worker` from the Daphne repository.
1. Update this README to note the Daphne commit used to generate these artifacts.

### License

The contents of `artifacts/daphne_compiled` are a compiled artifact of the
[Daphne](https://github.com/cloudflare/daphne) project, which is licensed under the [BSD 3-Clause
License](https://github.com/cloudflare/daphne/blob/2f042113af8df7527c1761490cea40139952ad5e/LICENSE),
reproduced below:

```
BSD 3-Clause License
Copyright (c) 2022, Cloudflare Inc.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
```
1. Update `Cargo.toml` in this directory to reference the new commit of Daphne.
1. Update `build.rs` in this directory to reference the new commit of Daphne.
1. Update this README to note the new commit of Daphne.
Binary file not shown.
Loading

0 comments on commit e4eba0c

Please sign in to comment.