Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/auth/credentials.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@ pub struct CredentialStore {
impl CredentialStore {
/// Create a new credential store, testing keyring availability
pub fn new() -> Self {
// Integration tests pin the credentials file, since dirs::home_dir
// ignores HOME and USERPROFILE on Windows. Skips the keyring too.
#[cfg(all(not(test), feature = "test-support"))]
if let Some(path) = std::env::var_os("AUTTER_TEST_CREDENTIALS_PATH") {
return Self {
backend: Box::new(FileBackend::new(PathBuf::from(path))),
};
}

// In test builds, always use file-based storage to avoid keyring blocking issues
#[cfg(test)]
{
Expand Down
3 changes: 2 additions & 1 deletion tests/integration/repos/test_repo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -480,10 +480,11 @@ impl DaemonProcess {
fn configure_test_home_env(command: &mut Command, test_home: &Path) {
command.env("HOME", test_home);
// dirs::home_dir uses Windows Known Folders, which ignores HOME and
// USERPROFILE. Pin these databases explicitly in test-support binaries.
// USERPROFILE. Pin these files explicitly in test-support binaries.
for (key, filename) in [
("AUTTER_TEST_METRICS_DB_PATH", "metrics-db"),
("AUTTER_TEST_NOTES_DB_PATH", "notes-db"),
("AUTTER_TEST_CREDENTIALS_PATH", "credentials"),
] {
if !command.get_envs().any(|(name, _)| name == key) {
command.env(key, test_home.join(".autter/internal").join(filename));
Expand Down
Loading