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

Create fastly-edge-assignments integration tests #75

Merged
merged 8 commits into from
Dec 11, 2024
Merged

Conversation

leoromanovsky
Copy link
Member

@leoromanovsky leoromanovsky commented Nov 25, 2024

Observation

Moving beyond the M1 for this project to a trusted tool, we need to add integration and unit tests.

A few constraints on testability is that we are compiling a wasm target and deploying to the fastly platform.

The purpose of this PR is to create the scaffolding for future tests and not an exhaustive suite.

Description

For integration testing I am choosing to use the fastly cli which comes with a rust build program; this is the same process we use for building the deployable package.

Viceroy will let us locally create fastly services; we already use it for running the local environment with a pre-populated KV store entry.

cargo-nextest is a test runner recommended by fastly.

I followed the fastly guides (https://www.fastly.com/blog/how-to-write-rust-unit-tests-for-your-compute-edge-application).

#[fastly::main]
fn main(req: Request) -> Result<Response, Error> {
fn main() -> Result<(), Error> {
let ds_req = Request::from_client();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is required scaffolding to run integration tests.

@leoromanovsky leoromanovsky marked this pull request as ready for review November 25, 2024 18:59
target: wasm32-wasi

# Install tools only if not cached
- name: Install Tools
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this step takes ~7 min so I added it to the github cache

.github/workflows/fastly-edge-assignments.yml Outdated Show resolved Hide resolved
@leoromanovsky leoromanovsky merged commit d8dd6e5 into main Dec 11, 2024
27 checks passed
@leoromanovsky leoromanovsky deleted the lr/poc-tests branch December 11, 2024 03:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants