Issue 902 fails (#1227)

## Notes

All users in the test set have been ensured to have a
complete set of populated data, relevant to the per-
category-per-user assertions in the test.

## Type of change

- [x] 🐛 Bugfix
- [x] 🤖 Test

## Issue(s)

* #902

## Test Plan

- [x] 💪 Manual
- [x] 💚 E2E
This commit is contained in:
Keepers 2022-10-19 15:58:48 -06:00 committed by GitHub
parent 4cc60be091
commit d98ba729b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,6 +3,7 @@ package repository_test
import (
"context"
"runtime/pprof"
"sort"
"testing"
"github.com/stretchr/testify/assert"
@ -39,7 +40,6 @@ var alcUsers = []string{
"MeganB@8qzvrj.onmicrosoft.com",
"MiriamG@8qzvrj.onmicrosoft.com",
"NestorW@8qzvrj.onmicrosoft.com",
"ntoja@8qzvrj.onmicrosoft.com",
"PattiF@8qzvrj.onmicrosoft.com",
"PradeepG@8qzvrj.onmicrosoft.com",
"Rfinders@8qzvrj.onmicrosoft.com",
@ -50,6 +50,7 @@ var alcUsers = []string{
// they are reserved for other purposes
// "LeeG@8qzvrj.onmicrosoft.com",
// "ntoja@8qzvrj.onmicrosoft.com",
}
var largeDatasetUser = []string{"LeeG@8qzvrj.onmicrosoft.com"}
@ -282,15 +283,33 @@ func ensureAllUsersInDetails(
userCategories[ro][ct.String()] = struct{}{}
}
foundCategoriesSl := normalizeCategorySet(t, foundCategories)
for u, cats := range userCategories {
userCategoriesSl := normalizeCategorySet(t, cats)
t.Run(u, func(t *testing.T) {
assert.True(t, foundUsers[u], "user was involved in operation")
assert.Equal(t, len(foundCategories), len(cats), "all app categories involved in operation")
assert.EqualValues(t, foundCategoriesSl, userCategoriesSl, "user had all app categories involved in operation")
})
}
})
}
// for an easier time comparing category presence/absence
func normalizeCategorySet(t *testing.T, cats map[string]struct{}) []string {
t.Helper()
sl := []string{}
for k := range cats {
sl = append(sl, k)
}
sort.Strings(sl)
return sl
}
// ------------------------------------------------------------------------------------------------
// Exchange
// ------------------------------------------------------------------------------------------------