mirror of
https://relay.ngit.dev/npub15qydau2hjma6ngxkl2cyar74wzyjshvl65za5k5rl69264ar2exs5cyejr/ngit-grasp.git
synced 2026-10-05 23:18:24 +00:00
test: disable GPG signing in all test helpers
Prevent GPG signing prompts (including Yubikey activation) during test runs by explicitly disabling commit.gpgsign and tag.gpgsign in all test repository creation helpers. Modified: - tests/common/purgatory_helpers.rs: create_test_repo_with_commit() - src/git/mod.rs: create_test_repo_with_commit() - src/purgatory/helpers.rs: create_test_repo_with_commit() All test repositories now have GPG signing disabled regardless of global git configuration.
This commit is contained in:
@@ -535,6 +535,17 @@ mod tests {
|
||||
.current_dir(&work_dir)
|
||||
.output()
|
||||
.unwrap();
|
||||
// Disable GPG signing for tests (prevents yubikey prompts)
|
||||
Command::new("git")
|
||||
.args(["config", "commit.gpgsign", "false"])
|
||||
.current_dir(&work_dir)
|
||||
.output()
|
||||
.unwrap();
|
||||
Command::new("git")
|
||||
.args(["config", "tag.gpgsign", "false"])
|
||||
.current_dir(&work_dir)
|
||||
.output()
|
||||
.unwrap();
|
||||
|
||||
// Create a file and commit
|
||||
fs::write(work_dir.join("README.md"), "# Test").unwrap();
|
||||
|
||||
@@ -534,6 +534,19 @@ mod tests {
|
||||
.output()
|
||||
.expect("Failed to set name");
|
||||
|
||||
// Disable GPG signing for tests (prevents yubikey prompts)
|
||||
Command::new("git")
|
||||
.args(["config", "commit.gpgsign", "false"])
|
||||
.current_dir(work_dir.path())
|
||||
.output()
|
||||
.expect("Failed to disable commit.gpgsign");
|
||||
|
||||
Command::new("git")
|
||||
.args(["config", "tag.gpgsign", "false"])
|
||||
.current_dir(work_dir.path())
|
||||
.output()
|
||||
.expect("Failed to disable tag.gpgsign");
|
||||
|
||||
// Create a commit
|
||||
std::fs::write(work_dir.path().join("file.txt"), "content").unwrap();
|
||||
Command::new("git")
|
||||
|
||||
@@ -51,6 +51,10 @@ pub fn create_test_repo_with_commit(path: &Path, variant: CommitVariant) -> Resu
|
||||
// Configure git user for commits
|
||||
run_git(path, &["config", "user.email", "test@example.com"])?;
|
||||
run_git(path, &["config", "user.name", "Test User"])?;
|
||||
|
||||
// Disable GPG signing for tests (prevents yubikey prompts)
|
||||
run_git(path, &["config", "commit.gpgsign", "false"])?;
|
||||
run_git(path, &["config", "tag.gpgsign", "false"])?;
|
||||
|
||||
// Create a file based on variant
|
||||
let (filename, content) = match variant {
|
||||
|
||||
Reference in New Issue
Block a user