aboutsummaryrefslogtreecommitdiff
path: root/pkg/api
diff options
context:
space:
mode:
authorpg9182 <96569817+pg9182@users.noreply.github.com>2022-10-21 14:52:34 -0400
committerpg9182 <96569817+pg9182@users.noreply.github.com>2022-10-21 14:52:34 -0400
commitdd5bb4e71abed1beb1b104281feb7b275a3530c6 (patch)
tree47297bb1c3fb1c581ccb515c3a67151b2a98ee2e /pkg/api
parent69277ebe2c75607d8a67a64f9acc7a49374c307b (diff)
downloadAtlas-dd5bb4e71abed1beb1b104281feb7b275a3530c6.tar.gz
Atlas-dd5bb4e71abed1beb1b104281feb7b275a3530c6.zip
pkg/api/api0/api0testutil: Reduce stress test concurrency on non-Linux platforms
Database doesn't perform as well.
Diffstat (limited to 'pkg/api')
-rw-r--r--pkg/api/api0/api0testutil/storage.go22
1 files changed, 14 insertions, 8 deletions
diff --git a/pkg/api/api0/api0testutil/storage.go b/pkg/api/api0/api0testutil/storage.go
index ef2a5bf..a32de6d 100644
--- a/pkg/api/api0/api0testutil/storage.go
+++ b/pkg/api/api0/api0testutil/storage.go
@@ -175,10 +175,13 @@ func TestAccountStorage(t *testing.T, s api0.AccountStorage) {
// test that it still functions properly with large numbers of users and
// randomly ordered concurrent writers
t.Run("Stress", func(t *testing.T) {
- const (
- concurrency = 32
- users = 16384
+ var (
+ concurrency int = 32
+ users uint64 = 16384
)
+ if runtime.GOOS != "linux" {
+ concurrency = 16 // doesn't perform as well for database locking, and it's not our primary target anyways
+ }
var wg sync.WaitGroup
var fail atomic.Int32
var nfail atomic.Int32
@@ -227,7 +230,7 @@ func TestAccountStorage(t *testing.T, s api0.AccountStorage) {
randSched()
// simulate auth
- uacct.Username = "user" + strconv.Itoa(rand.Intn(users/8)) // generate a username with overlap
+ uacct.Username = "user" + strconv.Itoa(rand.Intn(int(users/8))) // generate a username with overlap
uacct.AuthIP = netip.MustParseAddr("127.0.0.1")
uacct.AuthToken = "dummy"
uacct.AuthTokenExpiry = time.Now().Add(time.Minute * 30).Truncate(time.Second)
@@ -277,7 +280,7 @@ func TestAccountStorage(t *testing.T, s api0.AccountStorage) {
// generate a new username
oldu := uacct.Username
- uacct.Username = "user" + strconv.Itoa(rand.Intn(users/8)) + "new"
+ uacct.Username = "user" + strconv.Itoa(rand.Intn(int(users/8))) + "new"
// update the account
if err := s.SaveAccount(uacct); err != nil {
@@ -504,10 +507,13 @@ func TestPdataStorage(t *testing.T, s api0.PdataStorage) {
// test that it still functions properly with large numbers of users and
// randomly ordered concurrent writers
t.Run("Stress", func(t *testing.T) {
- const (
- concurrency = 32
- users = 4096
+ var (
+ concurrency int = 32
+ users uint64 = 16384
)
+ if runtime.GOOS != "linux" {
+ concurrency = 16 // doesn't perform as well for database locking, and it's not our primary target anyways
+ }
var wg sync.WaitGroup
var fail atomic.Int32
var nfail atomic.Int32