drop the proposed config repo: applied seeds from forge main, and the dead pending-init topology list goes with it
This commit is contained in:
parent
08b8eb3f73
commit
25295fd33f
1 changed files with 225 additions and 520 deletions
|
|
@ -3,27 +3,31 @@
|
|||
|
||||
use super::*;
|
||||
|
||||
/// Regression test: `setup_proposed` must seed both agent.nix and flake.nix
|
||||
/// in the initial commit. Before commit 5b5a93e flake.nix was missing from
|
||||
/// the scaffold, requiring manual creation (seen with the damocles agent).
|
||||
/// Regression test: `setup_applied` must seed both agent.nix and flake.nix
|
||||
/// in the initial commit, and tag it `deployed/0`. Before commit 5b5a93e
|
||||
/// flake.nix was missing from the scaffold, requiring manual creation (seen
|
||||
/// with the damocles agent).
|
||||
///
|
||||
/// Exercises the template arm: there is no forge to clone from in a test
|
||||
/// (`forge::is_present` needs the priv socket), so `setup_proposed` falls
|
||||
/// through to `seed_template` — which is the arm this asserts about.
|
||||
/// Exercises the template arm: there is no forge to take a config from in a
|
||||
/// test (no reader token), so `setup_applied` falls through to
|
||||
/// `seed_template` — which is the arm this asserts about.
|
||||
#[tokio::test]
|
||||
async fn setup_proposed_seeds_flake_nix() {
|
||||
async fn setup_applied_seeds_flake_nix() {
|
||||
let dir = tempfile::tempdir().expect("tempdir");
|
||||
let proposed = dir.path().join("proposed");
|
||||
setup_proposed(&proposed, "test-agent")
|
||||
let applied = dir.path().join("applied");
|
||||
setup_applied(&applied, "test-agent")
|
||||
.await
|
||||
.expect("setup_proposed");
|
||||
.expect("setup_applied");
|
||||
git_rev_parse(&applied, "refs/tags/deployed/0")
|
||||
.await
|
||||
.expect("the seed commit is tagged deployed/0");
|
||||
|
||||
// Both files must exist on disk.
|
||||
assert!(proposed.join("agent.nix").exists(), "agent.nix missing");
|
||||
assert!(proposed.join("flake.nix").exists(), "flake.nix missing");
|
||||
assert!(applied.join("agent.nix").exists(), "agent.nix missing");
|
||||
assert!(applied.join("flake.nix").exists(), "flake.nix missing");
|
||||
|
||||
// flake.nix must export nixosModules.default (the meta-flake contract).
|
||||
let flake = std::fs::read_to_string(proposed.join("flake.nix")).unwrap();
|
||||
let flake = std::fs::read_to_string(applied.join("flake.nix")).unwrap();
|
||||
assert!(
|
||||
flake.contains("nixosModules.default"),
|
||||
"flake.nix does not export nixosModules.default"
|
||||
|
|
@ -31,7 +35,7 @@ async fn setup_proposed_seeds_flake_nix() {
|
|||
|
||||
// Both files must be tracked in the initial git commit.
|
||||
let out = git_command()
|
||||
.current_dir(&proposed)
|
||||
.current_dir(&applied)
|
||||
.args(["show", "--name-only", "--format=", "HEAD"])
|
||||
.output()
|
||||
.await
|
||||
|
|
@ -128,22 +132,22 @@ fn network_isolation_errors_name_the_offending_variable() {
|
|||
);
|
||||
}
|
||||
|
||||
/// `setup_proposed` is idempotent: calling it on an existing repo is a
|
||||
/// no-op (the fresh guard skips all writes).
|
||||
/// `setup_applied` is idempotent: calling it on an already seeded repo is a
|
||||
/// no-op (the shape check passes and nothing is written).
|
||||
#[tokio::test]
|
||||
async fn setup_proposed_idempotent() {
|
||||
async fn setup_applied_idempotent() {
|
||||
let dir = tempfile::tempdir().expect("tempdir");
|
||||
let proposed = dir.path().join("proposed");
|
||||
setup_proposed(&proposed, "test-agent")
|
||||
let applied = dir.path().join("applied");
|
||||
setup_applied(&applied, "test-agent")
|
||||
.await
|
||||
.expect("first call");
|
||||
// Second call must not error even though .git already exists.
|
||||
setup_proposed(&proposed, "test-agent")
|
||||
setup_applied(&applied, "test-agent")
|
||||
.await
|
||||
.expect("second call");
|
||||
// Still one commit.
|
||||
let out = git_command()
|
||||
.current_dir(&proposed)
|
||||
.current_dir(&applied)
|
||||
.args(["rev-list", "--count", "HEAD"])
|
||||
.output()
|
||||
.await
|
||||
|
|
@ -158,10 +162,10 @@ async fn setup_proposed_idempotent() {
|
|||
/// Build a two-commit repo and return `(dir, repo_path, first, second)`.
|
||||
async fn two_commit_repo() -> (tempfile::TempDir, std::path::PathBuf, String, String) {
|
||||
let dir = tempfile::tempdir().expect("tempdir");
|
||||
let repo = dir.path().join("proposed");
|
||||
setup_proposed(&repo, "test-agent")
|
||||
let repo = dir.path().join("applied");
|
||||
setup_applied(&repo, "test-agent")
|
||||
.await
|
||||
.expect("setup_proposed");
|
||||
.expect("setup_applied");
|
||||
let first = git_rev_parse(&repo, "HEAD").await.expect("rev-parse first");
|
||||
|
||||
std::fs::write(repo.join("second.txt"), "second").expect("write second.txt");
|
||||
|
|
|
|||
Loading…
Reference in a new issue