@platformatic/watt-extra 1.16.0 → 1.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -122,9 +122,14 @@ test('ICC coordination: should disable local jobs regardless of scheduler mode',
122
122
  await icc.close()
123
123
  })
124
124
 
125
- // ICC coordination always disables local execution.
125
+ // ICC coordination always disables local execution: released runtimes
126
+ // disable the job in config, runtimes with scheduler control pause it.
126
127
  const config = await app.watt.runtime.getRuntimeConfig()
127
- assert.strictEqual(config.scheduler[0].enabled, false)
128
+ if (typeof app.watt.runtime.pauseSchedulerJob === 'function') {
129
+ assert.strictEqual(app.watt.runtime.getScheduler()[0].paused, true)
130
+ } else {
131
+ assert.strictEqual(config.scheduler[0].enabled, false)
132
+ }
128
133
 
129
134
  assert.ok(savedWattJob)
130
135
  })
@@ -46,17 +46,21 @@ test('should spawn a runtime disabling all the scheduler jobs', async (t) => {
46
46
 
47
47
  const { scheduler } = config
48
48
 
49
- // The scheduler should be disabled
50
- const expectedSchedulerConfig = [{
51
- enabled: false,
52
- name: 'test',
53
- callbackUrl: 'http://localhost:3000',
54
- cron: '*/5 * * * *',
55
- method: 'GET',
56
- maxRetries: 3
57
- }]
58
-
59
- assert.deepStrictEqual(scheduler, expectedSchedulerConfig)
49
+ if (typeof app.watt.runtime.pauseSchedulerJob === 'function') {
50
+ // Runtimes exposing scheduler control keep the job enabled in config and
51
+ // pause it at runtime instead of disabling it.
52
+ assert.notStrictEqual(scheduler[0].enabled, false)
53
+ } else {
54
+ // Legacy runtimes disable the job in the config patch.
55
+ assert.deepStrictEqual(scheduler, [{
56
+ enabled: false,
57
+ name: 'test',
58
+ callbackUrl: 'http://localhost:3000',
59
+ cron: '*/5 * * * *',
60
+ method: 'GET',
61
+ maxRetries: 3
62
+ }])
63
+ }
60
64
 
61
65
  // ICC is called to save the job
62
66
  const expectedWattJob = {