SANDBOX-1568: fix flaky TestActivationCodeVerification/over_capacity test#1247
Conversation
WalkthroughThe test TestActivationCodeVerification in Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
📜 Recent review detailsConfiguration used: Organization UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
alexeykazakov
left a comment
There was a problem hiding this comment.
Looks good. But can you add a short comment to the code explaining why we have to set the Max Attendees to 0 instead of manipulating the activation count.
mfrancisc
left a comment
There was a problem hiding this comment.
Nice catch 👍
Indeed it looks like the socialevent_controller.go recalculates event.Status.ActivationCount for every reconcile.
|
MatousJobanek
left a comment
There was a problem hiding this comment.
good catch 👍
/lgtm
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: alexeykazakov, MatousJobanek, mfrancisc, rsoaresd The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |



Description
TestActivationCodeVerification/over_capacity is intermittently failing with 200 OK instead of expected 403 Forbidden.
The test manually set
ev.Status.ActivationCount = event.Spec.MaxAttendeesto simulate a full event, but I think the controller continuously recalculates this field by counting actual approved UserSignups when the reconcialiation is triggered maybe due to other parrallel test.In the registration-service logs, we can see that event.Status.ActivationCount is 0, so the update was "override":
{"level":"info","ts":"2026-01-10T10:06:05.603Z","logger":"registration-service","msg":"verifying activation code 'pm7f3': event.Status.ActivationCount=%!d(string=0), event.Spec.MaxAttendees=10, event.Spec.StartTime=2026-01-10:09:06:05, event.Spec.EndTime=2026-01-10:11:06:05","timestamp":"Sat, 10 Jan 2026 10:06:05 +0000","commit":"a735f59","user_id":"bbaf8538-2791-4d84-b22b-8b664bbc7f38","username":"testuser-86a653d2-fc36-4cf2-9941-72ff2c358f6f","req_url":":///api/v1/signup/verification/activation-code","req_headers":{"Accept-Encoding":["gzip"],"Authorization":"*****","Content-Length":["16"],"Content-Type":["application/json"],"Forwarded":["for=18.212.185.4;host=registration-service-toolchain-host-10094952.apps.ci-op-xj3nk99s-b000e.devsandboxci.devcluster.openshift.com;proto=https"],"User-Agent":["Go-http-client/1.1"],"X-Forwarded-For":["18.212.185.4"],"X-Forwarded-Host":["registration-service-toolchain-host-10094952.apps.ci-op-xj3nk99s-b000e.devsandboxci.devcluster.openshift.com"],"X-Forwarded-Port":["443"],"X-Forwarded-Proto":["https"]},"req_payload":""}In the host operator logs, we can see a reconcialiton error:
{"level":"error","ts":"2026-01-10T10:06:05.102Z","msg":"Reconciler error","controller":"socialevent","controllerGroup":"toolchain.dev.openshift.com","controllerKind":"SocialEvent","SocialEvent":{"name":"pm7f3","namespace":"toolchain-host-10094952"},"namespace":"toolchain-host-10094952","name":"pm7f3","reconcileID":"d9a5d2ec-9223-4245-9cb4-1a3e5f21bdc3","error":"unable to update status with activation count: Operation cannot be fulfilled on socialevents.toolchain.dev.openshift.com \"pm7f3\": the object has been modified; please apply your changes to the latest version and try again","errorVerbose":"Operation cannot be fulfilled on socialevents.toolchain.dev.openshift.com \"pm7f3\": the object has been modified; please apply your changes to the latest version and try again ..."So, this PR suggest chaging MaxAttendees to 0, so the event is genuinely full from creation
Issue ticket number and link
SANDBOX-1568
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.