Skip to content

THREESCALE-6077: job sync system zync#4307

Open
jlledom wants to merge 3 commits into
masterfrom
THREESCALE-6077-job-sync-system-zync
Open

THREESCALE-6077: job sync system zync#4307
jlledom wants to merge 3 commits into
masterfrom
THREESCALE-6077-job-sync-system-zync

Conversation

@jlledom
Copy link
Copy Markdown
Contributor

@jlledom jlledom commented May 22, 2026

What this PR does / why we need it:

Just a rake task to dump all existing data from porta to zync, in case we need to do a full resync after say a db reset.

It also adds some tests for the new task.

Which issue(s) this PR fixes

https://redhat.atlassian.net/browse/THREESCALE-6077

Verification steps

bundle exec rails zync:resync:full

or

PROVIDER_ID=2 bundle exec rails zync:resync:full

jlledom added 3 commits May 21, 2026 17:44
Replaced the hardcoded batch size value (100) with a module-level
BATCH_SIZE constant to improve maintainability and eliminate magic
numbers. This makes it easier to adjust batch processing behavior
across all zync resync tasks from a single location.
Introduces a new zync:resync:full task that comprehensively resyncs
all provider accounts, services, proxies, and applications with the
Zync service. The task publishes domain change events, OIDC
configuration updates, and application creation events to ensure
complete synchronization.

Supports selective resync via PROVIDER_ID environment variable for
troubleshooting individual providers, otherwise processes all active
(non-suspended, non-deleted) providers in the system.
Adds test suite for the zync:resync:full rake task with coverage for:
- Base full resync across all providers, services, and applications
- PROVIDER_ID environment variable filtering to scope resync to a
  single provider
- Exclusion of suspended providers from resync
- Exclusion of scheduled_for_deletion providers from resync

Tests use helper methods (expect_full_resync_events and
expect_no_resync_events) to reduce duplication and improve readability.
Organized into nested test classes (DomainsSyncTest and FullSyncTest)
for better test organization.

Assisted-by: Claude Code
@jlledom jlledom self-assigned this May 22, 2026
@qltysh
Copy link
Copy Markdown

qltysh Bot commented May 22, 2026

❌ 17 blocking issues (19 total)

Tool Category Rule Count
reek Lint Tasks::ZyncTest::FullSyncTest has the variable name 'a' 8
reek Lint Tasks::ZyncTest::FullSyncTest#expect_full_resync_events calls 'service.proxy' 2 times 4
rubocop Lint Block has too many lines. [54/25] 2
rubocop Style Use \(index % BATCH\_SIZE\)\.zero? instead of \(index % BATCH\_SIZE\) == 0. 1
rubocop Style Use ENV\.fetch\("PROVIDER\_ID", nil\) instead of ENV\["PROVIDER\_ID"\]. 1
reek Lint Tasks::ZyncTest::FullSyncTest#expect_full_resync_events has approx 8 statements 1
qlty Duplication Found 15 lines of similar code in 2 locations (mass = 109) 2

Comment thread lib/tasks/zync.rake
task domains: [:provider_domains, :proxy_domains]

desc 'Full resync'
task full: :environment do
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we define this task as empty body but just add all resync types as dependencies?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants