Skip to content

Commit

Permalink
derp tests
Browse files Browse the repository at this point in the history
  • Loading branch information
grahamc committed Jan 10, 2025
1 parent aff58b3 commit 8e0c274
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 15 deletions.
26 changes: 19 additions & 7 deletions src/action/base/create_or_merge_nix_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,9 @@ mod test {
nix_config
.settings_mut()
.insert("experimental-features".into(), "ca-references".into());
let mut action = CreateOrMergeNixConfig::plan(&test_file, nix_config).await?;
let mut action =
CreateOrMergeNixConfig::plan(&test_file, nix_config, "# Generated by".to_string())
.await?;

action.try_execute().await?;

Expand All @@ -492,7 +494,9 @@ mod test {
nix_config
.settings_mut()
.insert("experimental-features".into(), "ca-references".into());
let mut action = CreateOrMergeNixConfig::plan(&test_file, nix_config).await?;
let mut action =
CreateOrMergeNixConfig::plan(&test_file, nix_config, "# Generated by".to_string())
.await?;

action.try_execute().await?;

Expand Down Expand Up @@ -520,7 +524,9 @@ mod test {
nix_config
.settings_mut()
.insert("experimental-features".into(), "flakes".into());
let mut action = CreateOrMergeNixConfig::plan(&test_file, nix_config).await?;
let mut action =
CreateOrMergeNixConfig::plan(&test_file, nix_config, "# Generated by".to_string())
.await?;

action.try_execute().await?;

Expand Down Expand Up @@ -552,7 +558,9 @@ mod test {
nix_config
.settings_mut()
.insert("allow-dirty".into(), "false".into());
let mut action = CreateOrMergeNixConfig::plan(&test_file, nix_config).await?;
let mut action =
CreateOrMergeNixConfig::plan(&test_file, nix_config, "# Generated by".to_string())
.await?;

action.try_execute().await?;

Expand Down Expand Up @@ -597,7 +605,7 @@ mod test {
nix_config
.settings_mut()
.insert("warn-dirty".into(), "false".into());
match CreateOrMergeNixConfig::plan(&test_file, nix_config).await {
match CreateOrMergeNixConfig::plan(&test_file, nix_config, "".to_string()).await {
Err(err) => {
if let ActionErrorKind::Custom(e) = err.kind() {
match e.downcast_ref::<CreateOrMergeNixConfigError>() {
Expand Down Expand Up @@ -639,7 +647,9 @@ mod test {
nix_config
.settings_mut()
.insert("experimental-features".into(), "ca-references".into());
let mut action = CreateOrMergeNixConfig::plan(&test_file, nix_config).await?;
let mut action =
CreateOrMergeNixConfig::plan(&test_file, nix_config, "# Generated by".to_string())
.await?;

action.try_execute().await?;

Expand Down Expand Up @@ -671,7 +681,9 @@ mod test {
nix_config
.settings_mut()
.insert("experimental-features".into(), "ca-references".into());
let mut action = CreateOrMergeNixConfig::plan(&test_file, nix_config).await?;
let mut action =
CreateOrMergeNixConfig::plan(&test_file, nix_config, "# Generated by".to_string())
.await?;

action.try_execute().await?;

Expand Down
3 changes: 1 addition & 2 deletions src/action/common/place_nix_configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -339,11 +339,10 @@ mod tests {

#[tokio::test]
async fn extra_trusted_no_error() -> eyre::Result<()> {
let nix_config = PlaceNixConfiguration::setup_nix_config(
let nix_config = PlaceNixConfiguration::setup_extra_config(
String::from("foo"),
None,
None,
None,
vec![
UrlOrPathOrString::String(String::from("extra-trusted-substituters = barfoo")),
UrlOrPathOrString::String(String::from("extra-trusted-public-keys = foobar")),
Expand Down
17 changes: 15 additions & 2 deletions tests/fixtures/linux/linux.json
Original file line number Diff line number Diff line change
Expand Up @@ -1052,13 +1052,13 @@
},
"state": "Completed"
},
"create_or_merge_nix_config": {
"create_or_merge_standard_nix_config": {
"action": {
"action_name": "create_or_merge_nix_config",
"path": "/etc/nix/nix.conf",
"header": "# Generated by ...",
"pending_nix_config": {
"settings": {
"build-users-group": "nixbld",
"experimental-features": "nix-command flakes",
"auto-optimise-store": "true",
"always-allow-substitutes": "true",
Expand All @@ -1072,6 +1072,19 @@
}
},
"state": "Completed"
},
"create_or_merge_custom_nix_config": {
"action": {
"action_name": "create_or_merge_nix_config",
"path": "/etc/nix/nix.custom.conf",
"header": "# user settings...",
"pending_nix_config": {
"settings": {
"build-users-group": "nixbld"
}
}
},
"state": "Completed"
}
},
"state": "Completed"
Expand Down
17 changes: 15 additions & 2 deletions tests/fixtures/linux/steam-deck.json
Original file line number Diff line number Diff line change
Expand Up @@ -1113,13 +1113,13 @@
},
"state": "Completed"
},
"create_or_merge_nix_config": {
"create_or_merge_standard_nix_config": {
"action": {
"action_name": "create_or_merge_nix_config",
"path": "/etc/nix/nix.conf",
"header": "# Generated by...",
"pending_nix_config": {
"settings": {
"build-users-group": "nixbld",
"experimental-features": "nix-command flakes",
"auto-optimise-store": "true",
"always-allow-substitutes": "true",
Expand All @@ -1133,6 +1133,19 @@
}
},
"state": "Completed"
},
"create_or_merge_custom_nix_config": {
"action": {
"action_name": "create_or_merge_nix_config",
"path": "/etc/nix/nix.custom.conf",
"header": "# user settings...",
"pending_nix_config": {
"settings": {
"build-users-group": "nixbld"
}
}
},
"state": "Completed"
}
},
"state": "Completed"
Expand Down
17 changes: 15 additions & 2 deletions tests/fixtures/macos/macos.json
Original file line number Diff line number Diff line change
Expand Up @@ -1139,13 +1139,13 @@
},
"state": "Completed"
},
"create_or_merge_nix_config": {
"create_or_merge_standard_nix_config": {
"action": {
"action_name": "create_or_merge_nix_config",
"path": "/etc/nix/nix.conf",
"header": "# Generated by ...",
"pending_nix_config": {
"settings": {
"build-users-group": "nixbld",
"experimental-features": "nix-command flakes",
"always-allow-substitutes": "true",
"extra-trusted-substituters": "https://cache.flakehub.com",
Expand All @@ -1158,6 +1158,19 @@
}
},
"state": "Completed"
},
"create_or_merge_custom_nix_config": {
"action": {
"action_name": "create_or_merge_nix_config",
"path": "/etc/nix/nix.custom.conf",
"header": "# user settings...",
"pending_nix_config": {
"settings": {
"build-users-group": "nixbld"
}
}
},
"state": "Completed"
}
},
"state": "Completed"
Expand Down

0 comments on commit 8e0c274

Please sign in to comment.