TestLoadingPostgresTeamCRD PostgresTeamMap is the operator's internal representation of all PostgresTeam CRDs
(t *testing.T)
| 94 | |
| 95 | // TestLoadingPostgresTeamCRD PostgresTeamMap is the operator's internal representation of all PostgresTeam CRDs |
| 96 | func TestLoadingPostgresTeamCRD(t *testing.T) { |
| 97 | tests := []struct { |
| 98 | name string |
| 99 | crd acidv1.PostgresTeamList |
| 100 | ptm PostgresTeamMap |
| 101 | error string |
| 102 | }{ |
| 103 | { |
| 104 | "Check that CRD is imported correctly into the internal format", |
| 105 | pgTeamList, |
| 106 | pgTeamMap, |
| 107 | "Mismatch between PostgresTeam CRD and internal map", |
| 108 | }, |
| 109 | } |
| 110 | |
| 111 | for _, tt := range tests { |
| 112 | postgresTeamMap := PostgresTeamMap{} |
| 113 | postgresTeamMap.Load(&tt.crd) |
| 114 | for team, ptmeamMembership := range postgresTeamMap { |
| 115 | if !util.IsEqualIgnoreOrder(ptmeamMembership.AdditionalSuperuserTeams, tt.ptm[team].AdditionalSuperuserTeams) { |
| 116 | t.Errorf("%s: %v: expected additional members %#v, got %#v", tt.name, tt.error, tt.ptm, postgresTeamMap) |
| 117 | } |
| 118 | if !util.IsEqualIgnoreOrder(ptmeamMembership.AdditionalTeams, tt.ptm[team].AdditionalTeams) { |
| 119 | t.Errorf("%s: %v: expected additional teams %#v, got %#v", tt.name, tt.error, tt.ptm, postgresTeamMap) |
| 120 | } |
| 121 | if !util.IsEqualIgnoreOrder(ptmeamMembership.AdditionalMembers, tt.ptm[team].AdditionalMembers) { |
| 122 | t.Errorf("%s: %v: expected additional superuser teams %#v, got %#v", tt.name, tt.error, tt.ptm, postgresTeamMap) |
| 123 | } |
| 124 | } |
| 125 | } |
| 126 | } |
| 127 | |
| 128 | // TestGetAdditionalTeams if returns teams with and without transitive dependencies |
| 129 | func TestGetAdditionalTeams(t *testing.T) { |
nothing calls this directly
no test coverage detected