chore: add await to create organization in integration tests

This commit is contained in:
Stefan Benz 2024-12-03 11:49:48 +01:00
parent 6722479ad6
commit 2816f9a4f5
No known key found for this signature in database
GPG Key ID: 071AA751ED4F9D31

View File

@ -8,6 +8,7 @@ import (
"testing"
"time"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"golang.org/x/text/language"
"google.golang.org/grpc/codes"
@ -89,8 +90,13 @@ func TestAdd_MachineUser(t *testing.T) {
})
require.NoError(t, err)
_, err = Client.GetUserByID(OrgCTX, &management.GetUserByIDRequest{Id: res.GetUserId()})
require.NoError(t, err)
retryDuration, tick := integration.WaitForAndTickWithMaxDuration(OrgCTX, time.Minute)
require.EventuallyWithT(t, func(tt *assert.CollectT) {
resp, err := Client.GetUserByID(OrgCTX, &management.GetUserByIDRequest{Id: res.GetUserId()})
assert.NoError(tt, err)
assert.Equal(tt, res.GetUserId(), resp.GetUser().GetId())
}, retryDuration, tick, "awaiting successful TestAdd_MachineUser failed",
)
}
func TestAdd_MachineUserCustomID(t *testing.T) {
@ -105,9 +111,13 @@ func TestAdd_MachineUserCustomID(t *testing.T) {
AccessTokenType: 0,
})
require.NoError(t, err)
_, err = Client.GetUserByID(OrgCTX, &management.GetUserByIDRequest{Id: id})
require.NoError(t, err)
require.Equal(t, id, res.GetUserId())
retryDuration, tick := integration.WaitForAndTickWithMaxDuration(OrgCTX, time.Minute)
require.EventuallyWithT(t, func(tt *assert.CollectT) {
resp, err := Client.GetUserByID(OrgCTX, &management.GetUserByIDRequest{Id: id})
assert.NoError(tt, err)
assert.Equal(tt, id, resp.GetUser().GetId())
}, retryDuration, tick, "awaiting successful TestAdd_MachineUser failed",
)
}