Clarify existing repository errors
This commit is contained in:
@@ -74,3 +74,17 @@ func TestForgetUsesAgeAndCalendarRetention(t *testing.T) {
|
||||
t.Fatalf("disabled daily retention was included: %s", args)
|
||||
}
|
||||
}
|
||||
|
||||
func TestResticErrorExplainsExistingRepository(t *testing.T) {
|
||||
err := resticError("Fatal: create repository failed: config file already exists", fmt.Errorf("exit status 1"))
|
||||
if !strings.Contains(err.Error(), "already initialized") || !strings.Contains(err.Error(), "select Test") {
|
||||
t.Fatalf("unexpected error: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestResticErrorExplainsCiphertextVerification(t *testing.T) {
|
||||
err := resticError(`{"message_type":"exit_error","message":"Fatal: config or key abc is damaged: ciphertext verification failed"}`, fmt.Errorf("exit status 1"))
|
||||
if !strings.Contains(err.Error(), "password does not match") || strings.Contains(err.Error(), "abc") {
|
||||
t.Fatalf("unexpected error: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user