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

CONTRIBUTING.md and Testing changes #48

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

award28
Copy link

@award28 award28 commented May 3, 2023

Per @mpalmer's request in #39, I've extracted the testing and contributing changes into a separate PR. This still includes the changes to save-snapshot.

@mpalmer
Should we still maintain the run test binary? I don't see a reason why we would need to, but there may be something I'm not thinking of.

@bcheidemann From your comment here you mention

I think some minor updates are needed to tests/run.mjs (updating test to tests) and also the validation_state.snap.json files need to be added for the new test cases.

Could you lend me a hand on this PR to get those json files to work with the new testing approach?

@award28 award28 force-pushed the aw-contributing-and-testing branch from 53ffc60 to 2928a74 Compare May 3, 2023 01:31
@award28 award28 marked this pull request as ready for review May 3, 2023 01:36
@award28 award28 mentioned this pull request May 3, 2023
1 task
@bcheidemann
Copy link
Contributor

Could you lend me a hand on this PR to get those json files to work with the new testing approach?

@award28 Yeah of course :) There's two approaches we could take:

  1. "fix" run.mjs now (this would be a very minor change) and integrate the testing approach in a follow-up PR
  2. Integrate the testing approach in this PR and remove run.mjs

I've raised a quick fix for run.mjs in this PR. I'll start working on the changes needed to remove run.mjs now :) my preference would be to merge these changes as a separate PR since I don't want to risk unnecessarily delaying this one

@award28
Copy link
Author

award28 commented May 3, 2023

Definitely agree, thanks for the quick turn around! I've merged those changes into this branch. Based on feedback from #39, I should be good to remove the run binary and update CI.

@award28
Copy link
Author

award28 commented May 9, 2023

@mpalmer bumping this in case you missed it

@mpalmer
Copy link
Owner

mpalmer commented May 10, 2023

Thanks for the bump, @award28, this slipped off my radar. I've put this on my list to review tomorrow; to answer your question:

Should we still maintain the run test binary?

Burninate it.

Copy link
Owner

@mpalmer mpalmer left a comment

Choose a reason for hiding this comment

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

Very, very cool. Made a couple of copy edit suggestions, and I've got a question or two, but it's great stuff, definite improvement over my shell script.

uses: mfinelli/setup-shfmt@master

- name: Run shfmt
run: shfmt -d bin/* test/run
Copy link
Owner

Choose a reason for hiding this comment

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

While test/run is going away, the scripts in bin/ are going to hang around.

# Environment Setup

## Install Rust
Firstly, you'll need make any changes to the core functionality of this project. We recommend use `rustup`, on the recommendation of the rust team. You can find the installation instructions [here](https://www.rust-lang.org/tools/install).
Copy link
Owner

Choose a reason for hiding this comment

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

Bit of light copy-editing:

Suggested change
Firstly, you'll need make any changes to the core functionality of this project. We recommend use `rustup`, on the recommendation of the rust team. You can find the installation instructions [here](https://www.rust-lang.org/tools/install).
Firstly, you'll need a Rust toolchain to make any changes to the core functionality of this project. We recommend [using `rustup`](https://www.rust-lang.org/tools/install), because that's what the Rust core team recommend.

Submodule path 'src/schemastore': checked out 'd3e6ab7727380b214acbab05570fb09a3e5d2dfc'
```

At this point, you should be all set to `cargo run`! If you run into any issues here, please [create an issue](https://github.com/mpalmer/action-validator/issues/new/choose).
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
At this point, you should be all set to `cargo run`! If you run into any issues here, please [create an issue](https://github.com/mpalmer/action-validator/issues/new/choose).
At this point, you should be all set to `cargo run`!

Given we've got CI and (as I'm about to commit) nightly test builds, I'm willing to bet a reasonable sum that if cargo run doesn't work for someone, it's a problem on their end, and I, at least, don't have the capacity to provide tech support for peoples' Rust installs.

When the tests is run, the results of the test must exactly match those of the previous run. For this project,
the snapshot tests are named in the format `{next_id}_{whats_being_tested}` (e.g. `011_remote_checks_failure`).

If you have made changes which will change the output of the program and cause snapshots to fail, you can run
Copy link
Owner

Choose a reason for hiding this comment

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

Ooooh, shiny!

@@ -1,3 +1,5 @@
# Overview
Copy link
Owner

Choose a reason for hiding this comment

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

This is all good stuff, thanks for writing it up.



#[rstest]
#[case("001_basic_workflow")]
Copy link
Owner

Choose a reason for hiding this comment

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

Any chance we can sneak the list of tests to run straight off the filesystem, rather than having to list them here? Alternately, it seems like we're not exactly stretching the limits of rstest; perhaps it's overkill, and just a fn main() and a loop would do the trick for now?

Copy link
Contributor

Choose a reason for hiding this comment

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

Like this?

Copy link
Owner

Choose a reason for hiding this comment

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

That seems like a very neat way of going about it. Macro magic to the rescue!

}
}

fn _save_contents(
Copy link
Owner

Choose a reason for hiding this comment

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

What's the rationale for the _ prefix on these fns?

@bcheidemann
Copy link
Contributor

Any update on this? Happy to pick up the changes requested if you don't have capacity @award28 :)

@mpalmer
Copy link
Owner

mpalmer commented Jan 30, 2024

Hey @award28, do you have the bandwidth to push this through to completion, or shall @bcheidemann and myself finish it off and land it?

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.

3 participants