summaryrefslogtreecommitdiff
path: root/transaction_test.go
diff options
context:
space:
mode:
authorMarco Trevisan (Treviño) <[email protected]>2023-09-25 13:44:45 +0200
committerMarco Trevisan (Treviño) <[email protected]>2023-11-30 01:16:39 +0100
commita5f5ad6470e625b72c71cac9477173307b005af2 (patch)
tree9d4d6c20be67c47ed33162305f7796f020d35c6c /transaction_test.go
parentea51cc0fe42e421ba0eaedded96bfe6448cbc43c (diff)
transaction: Return errors wrapping pam.Error values on failure
If the transaction fails during start, there's no way to get the error detail in a programmatic way, so let's wrap the pam.Error to allow more per-type checks.
Diffstat (limited to 'transaction_test.go')
-rw-r--r--transaction_test.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/transaction_test.go b/transaction_test.go
index 809364c..5bc858e 100644
--- a/transaction_test.go
+++ b/transaction_test.go
@@ -208,6 +208,13 @@ func TestPAM_ConfDir_FailNoServiceOrUnsupported(t *testing.T) {
if len(s) == 0 {
t.Fatalf("error #expected an error message")
}
+ var pamErr Error
+ if !errors.As(err, &pamErr) {
+ t.Fatalf("error #unexpected type: %#v", err)
+ }
+ if pamErr != ErrAbort {
+ t.Fatalf("error #unexpected status: %v", pamErr)
+ }
}
func TestPAM_ConfDir_InfoMessage(t *testing.T) {