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

initialize test suite for git fetchers #9676

Merged
merged 6 commits into from
Jan 18, 2024
Merged

Conversation

DavHau
Copy link
Member

@DavHau DavHau commented Dec 29, 2023

solves #9388

This utilizes nixos vm tests to allow:

  • writing tests for fetchTree and fetchGit involving actual networking.
  • writing small independent test cases by automating local and remote repository setup per test case.

This adds:

  • a gitea module setting up a gitea server
  • a setup module that simplifies writing test cases by automating the repo setup.
  • a simple git http test case

Other improvements:
For all nixos tests, add capability of overriding the nix version to test against.
This should make it easier to prevent regressions. If a new test is added it can simply be ran against any older nix version without having to backport the test.
For example, for running the container tests against nix 2.12.0:
nix build "$(nix eval --raw .#hydraJobs.tests.containers --impure --apply 't: (t.forNix "2.12.0").drvPath')^*" -L

cc @roberth as you were involved in the discussion and provided directions.

}];
};
in
evaled.config.result;
Copy link
Member

Choose a reason for hiding this comment

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

We should have such functionality upstream.

Copy link
Member Author

@DavHau DavHau Jan 2, 2024

Choose a reason for hiding this comment

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

Is that a requirement for getting this PR merged?

Copy link
Member

Choose a reason for hiding this comment

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

Not really. This is going to sound harsh, but you could remove it instead.
By doing this here, it feels like we're done, but we've really just created an ad hoc implementation that we wouldn't really want to develop new feature for. It deserves a better place than this! I'd be happy to review the same functionality in Nixpkgs. Meanwhile, you can unblock this PR by simplifying it.

Copy link
Member Author

Choose a reason for hiding this comment

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

Alright, I removed the logic that exports the test cases as individual derivations

@edolstra edolstra added the idea approved The given proposal has been discussed and approved by the Nix team. An implementation is welcome. label Jan 5, 2024
@DavHau
Copy link
Member Author

DavHau commented Jan 11, 2024

Added some changes:

fetchGit: add simple test for ssh fetching

Also move tests to separate files which are auto-imported. This should allow people adding tests concurrently without introducing merge conflicts

solves NixOS#9388

This utilizes nixos vm tests to allow:
- writing tests for fetchTree and fetchGit involving actual networking.
- writing small independent test cases by automating local and remote repository setup per test case.

This adds:
  - a gitea module setting up a gitea server
  - a setup module that simplifies writing test cases by automating the repo setup.
  - a simple git http test case

Other improvements:
For all nixos tests, add capability of overriding the nix version to test against.
This should make it easier to prevent regressions. If a new test is added it can simply be ran against any older nix version without having to backport the test.
For example, for running the container tests against nix 2.12.0:
`nix build "$(nix eval --raw .#hydraJobs.tests.containers --impure --apply 't: (t.forNix "2.12.0").drvPath')^*" -L`
@DavHau DavHau force-pushed the git-testsuite branch 5 times, most recently from 1e82908 to 2cd6f1c Compare January 11, 2024 08:30
Also move tests to separate files which are auto-imported. This should allow people adding tests concurrently without introducing merge conflicts
tests/nixos/fetch-git/default.nix Outdated Show resolved Hide resolved
tests/nixos/fetch-git/testsupport/setup.nix Outdated Show resolved Hide resolved
@roberth roberth enabled auto-merge January 18, 2024 20:19
@roberth roberth merged commit 0bd9e10 into NixOS:master Jan 18, 2024
8 checks passed
@Ericson2314
Copy link
Member

Thanks @DavHau. It's really nice to have much more robust tests for this stuff.

@roberth roberth mentioned this pull request Jan 18, 2024
2 tasks
@DavHau DavHau deleted the git-testsuite branch January 19, 2024 05:19
@DavHau
Copy link
Member Author

DavHau commented Jan 19, 2024

Great, now what's missing is that these tests get actually run for PRs

tebowy pushed a commit to tebowy/nix that referenced this pull request Jul 11, 2024
initialize test suite for git fetchers

(cherry picked from commit 0bd9e10)
Change-Id: Idf94a47794190c3e1de07fc4e7848741c4e9ffed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
idea approved The given proposal has been discussed and approved by the Nix team. An implementation is welcome. tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants