Skip to content
This repository has been archived by the owner on May 2, 2024. It is now read-only.

Commit

Permalink
Renaming test cases and updating golden files
Browse files Browse the repository at this point in the history
Co-authored-by: Didier Roche <didrocks@ubuntu.com>
  • Loading branch information
denisonbarbosa and didrocks committed Sep 8, 2022
1 parent b511e08 commit 114743a
Show file tree
Hide file tree
Showing 43 changed files with 78 additions and 442 deletions.
73 changes: 36 additions & 37 deletions nss/aad-auth/integration_test.go
Expand Up @@ -35,50 +35,49 @@ func TestIntegration(t *testing.T) {
wantErr bool
}{
// List entry by name
"list entry from passwd by name": {db: "passwd", key: "myuser@domain.com"},
"list entry from group by name": {db: "group", key: "myuser@domain.com"},
"list entry from shadow by name": {db: "shadow", key: "myuser@domain.com"},
"error on listing entry by name from shadow without access to shadow": {db: "shadow", key: "myuser@domain.com", shadowMode: &noShadow, wantErr: true},
"list entry from passwd by name": {db: "passwd", key: "myuser@domain.com"},
"list entry from group by name": {db: "group", key: "myuser@domain.com"},
"list entry from shadow by name": {db: "shadow", key: "myuser@domain.com"},

// List entry by UID/GID
"list entry from passwd by uid": {db: "passwd", key: "165119649"},
"list entry from group by gid": {db: "group", key: "165119649"},
"error on listing entry from shadow by uid": {db: "shadow", key: "165119649", wantErr: true},
"list entry from passwd by uid": {db: "passwd", key: "165119649"},
"list entry from group by gid": {db: "group", key: "165119649"},
"error when listing entry from shadow by uid": {db: "shadow", key: "165119649", wantErr: true},

// List entries
"list entries in passwd": {db: "passwd"},
"list entries in group": {db: "group"},
"list entries in shadow": {db: "shadow"},
"list passwd": {db: "passwd"},
"list group": {db: "group"},
"list shadow": {db: "shadow"},

// List entries without access to shadow
"list entries in passwd without access to shadow": {db: "passwd", shadowMode: &noShadow},
"list entries in group without access to shadow": {db: "group", shadowMode: &noShadow},
"error on listing shadow without access to shadow": {db: "shadow", shadowMode: &noShadow, wantErr: true},
"list passwd without access to shadow": {db: "passwd", shadowMode: &noShadow},
"list group without access to shadow": {db: "group", shadowMode: &noShadow},
"returns nothing when listing shadow without access": {db: "shadow", shadowMode: &noShadow},

// List entries by name without access to shadow
"list entry from passwd by name without access to shadow": {db: "passwd", key: "myuser@domain.com", shadowMode: &noShadow},
"list entry from group by name without access to shadow": {db: "group", key: "myuser@domain.com", shadowMode: &noShadow},
"error on listing entry from shadow by name without access to shadow": {db: "shadow", key: "myuser@domain.com", shadowMode: &noShadow, wantErr: true},
"list entry from passwd by name without access to shadow": {db: "passwd", key: "myuser@domain.com", shadowMode: &noShadow},
"list entry from group by name without access to shadow": {db: "group", key: "myuser@domain.com", shadowMode: &noShadow},
"error when listing entry from shadow by name without access": {db: "shadow", key: "myuser@domain.com", shadowMode: &noShadow, wantErr: true},

// List entries by UID/GID without access to shadow
"list entry from passwd by uid without access to shadow": {db: "passwd", key: "165119649", shadowMode: &noShadow},
"list entry from group by gid without access to shadow": {db: "group", key: "165119649", shadowMode: &noShadow},
"error on listing entry from shadow by uid without access to shadow": {db: "shadow", key: "165119649", shadowMode: &noShadow, wantErr: true},
"list entry from passwd by uid without access to shadow": {db: "passwd", key: "165119649", shadowMode: &noShadow},
"list entry from group by gid without access to shadow": {db: "group", key: "165119649", shadowMode: &noShadow},
"error when listing entry from shadow by uid without access": {db: "shadow", key: "165119649", shadowMode: &noShadow, wantErr: true},

// Error on listing non-existent entry
"error on listing non-existent entry in passwd": {db: "passwd", key: "doesnotexist@domain.com", wantErr: true},
"error on listing non-existent entry in group": {db: "group", key: "doesnotexist@domain.com", wantErr: true},
"error on listing non-existent entry in shadow": {db: "shadow", key: "doesnotexist@domain.com", wantErr: true},
// Error when listing non-existent entry
"error when listing non-existent entry in passwd": {db: "passwd", key: "doesnotexist@domain.com", wantErr: true},
"error when listing non-existent entry in group": {db: "group", key: "doesnotexist@domain.com", wantErr: true},
"error when listing non-existent entry in shadow": {db: "shadow", key: "doesnotexist@domain.com", wantErr: true},

// error on listing without cache
"error on listing passwd without cache and no permission to create it": {db: "passwd", cacheDB: "nocache", rootUID: 4242., wantErr: true},
"error on listing group without cache and no permission to create it": {db: "group", cacheDB: "nocache", rootUID: 4242, wantErr: true},
"error on listing shadow without cache and no permission to create it": {db: "shadow", cacheDB: "nocache", rootUID: 4242, wantErr: true},
// Returns nothing when listing without cache
"returns nothing when listing passwd without cache and no permission to create it": {db: "passwd", cacheDB: "nocache", rootUID: 4242},
"returns nothing when listing group without cache and no permission to create it": {db: "group", cacheDB: "nocache", rootUID: 4242},
"returns nothing when listing shadow without cache and no permission to create it": {db: "shadow", cacheDB: "nocache", rootUID: 4242},

// error on listing with empty cache
"error on listing passwd with empty cache": {db: "passwd", cacheDB: "empty", wantErr: true},
"error on listing group with empty cache": {db: "group", cacheDB: "empty", wantErr: true},
"error on listing shadow with empty cache": {db: "shadow", cacheDB: "empty", wantErr: true},
// Returns nothing when listing with empty cache
"returns nothing when listing passwd with empty cache": {db: "passwd", cacheDB: "empty"},
"returns nothing when listing group with empty cache": {db: "group", cacheDB: "empty"},
"returns nothing when listing shadow with empty cache": {db: "shadow", cacheDB: "empty"},

// List local entry without cache
"list local passwd entry without cache": {db: "passwd", cacheDB: "nocache", key: "0"},
Expand All @@ -90,14 +89,14 @@ func TestIntegration(t *testing.T) {
"old entries in group are cleaned": {db: "group", cacheDB: "db_with_old_users"},
"old entries in shadow are cleaned": {db: "shadow", cacheDB: "db_with_old_users"},

// error on listing without permission on cache
"error on listing passwd without permission on cache": {db: "passwd", rootUID: 4242, wantErr: true},
"error on listing group without permission on cache": {db: "group", rootUID: 4242, wantErr: true},
"error on listing shadow without permission on cache": {db: "shadow", rootUID: 4242, wantErr: true},
// Returns nothing when listing without permission on cache
"returns nothing when listing passwd without permission on cache": {db: "passwd", rootUID: 4242},
"returns nothing when listing group without permission on cache": {db: "group", rootUID: 4242},
"returns nothing when listing shadow without permission on cache": {db: "shadow", rootUID: 4242},

// Error when trying to list from unsupported database
"error trying to list entry by name from unsupported db": {db: "unsupported", key: "myuser@domain.com", wantErr: true},
"error trying to list unsupported db": {db: "unsupported", wantErr: true},
"error on trying to list entry by name from unsupported db": {db: "unsupported", key: "myuser@domain.com", wantErr: true},
"error on trying to list unsupported db": {db: "unsupported", wantErr: true},

// Error when trying to list from db with an explicit empty key
"error on get entry from passwd with explicit empty key": {db: "passwd", key: "-", wantErr: true},
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

26 changes: 0 additions & 26 deletions nss/aad-auth/testdata/golden/TestIntegration/list_entries_in_group

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit 114743a

Please sign in to comment.