Skip to content

Commit

Permalink
Merge branch 'upstream/release52' into upstream/peripheral-device-set…
Browse files Browse the repository at this point in the history
…tings-from-blueprints
  • Loading branch information
Julusian committed Dec 11, 2024
2 parents 878214b + dd5010a commit 0b5412a
Show file tree
Hide file tree
Showing 132 changed files with 2,505 additions and 4,050 deletions.
4 changes: 2 additions & 2 deletions DEVELOPER.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ However, one usage by AdlibActions for their userDataManifest remains as this is

## Blueprint Migrations

In R49, a replacement flow was added consisting of `validateConfig` and `applyConfig`.
It is no longer recommended to use the old migrations flow for showstyle and studio blueprints.
In R52, the replacement flow of `validateConfig` and `applyConfig` was extended to the system blueprint
It is no longer recommended to use the old migrations flow for system blueprints.

### ExpectedMediaItems

Expand Down
4 changes: 2 additions & 2 deletions meteor/__mocks__/defaultCollectionObjects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,15 @@ export function defaultStudio(_id: StudioId): DBStudio {
mappingsWithOverrides: wrapDefaultObject({}),
supportedShowStyleBase: [],
blueprintConfigWithOverrides: wrapDefaultObject({}),
settings: {
settingsWithOverrides: wrapDefaultObject({
frameRate: 25,
mediaPreviewsUrl: '',
minimumTakeSpan: DEFAULT_MINIMUM_TAKE_SPAN,
fallbackPartDuration: DEFAULT_FALLBACK_PART_DURATION,
allowHold: false,
allowPieceDirectPlay: false,
enableBuckets: false,
},
}),
_rundownVersionHash: '',
routeSetsWithOverrides: wrapDefaultObject({}),
routeSetExclusivityGroupsWithOverrides: wrapDefaultObject({}),
Expand Down
21 changes: 19 additions & 2 deletions meteor/__mocks__/helpers/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,25 @@ export async function setupMockCore(doc?: Partial<ICoreSystem>): Promise<ICoreSy
version: '0.0.0',
previousVersion: '0.0.0',
serviceMessages: {},
settingsWithOverrides: wrapDefaultObject({
cron: {
casparCGRestart: {
enabled: true,
},
storeRundownSnapshots: {
enabled: false,
},
},
support: {
message: '',
},
evaluationsMessage: {
enabled: false,
heading: '',
message: '',
},
}),
lastBlueprintConfig: undefined,
}
const coreSystem = _.extend(defaultCore, doc)
await CoreSystem.removeAsync(SYSTEM_ID)
Expand Down Expand Up @@ -367,7 +386,6 @@ export async function setupMockStudioBlueprint(
},

studioConfigSchema: '{}' as any,
studioMigrations: [],
getBaseline: () => {
return {
timelineObjects: [],
Expand Down Expand Up @@ -424,7 +442,6 @@ export async function setupMockShowStyleBlueprint(
},

showStyleConfigSchema: '{}' as any,
showStyleMigrations: [],
getShowStyleVariantId: (): string | null => {
return SHOW_STYLE_VARIANT_ID
},
Expand Down
2 changes: 1 addition & 1 deletion meteor/__mocks__/webapp.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export const WebAppMock = {
rawConnectHandlers: {
rawHandlers: {
use: (): void => {
// No web server to setup
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
} from '@sofie-automation/meteor-lib/dist/collections/CoreSystem'
import { CoreSystem } from '../../../collections'
import { SupressLogMessages } from '../../../../__mocks__/suppressLogging'
import { wrapDefaultObject } from '@sofie-automation/corelib/dist/settings/objectWithOverrides'

function convertExternalToServiceMessage(message: ExternalServiceMessage): ServiceMessage {
return {
Expand Down Expand Up @@ -42,6 +43,8 @@ const fakeCoreSystem: ICoreSystem = {
version: '3',
previousVersion: null,
serviceMessages: {},
settingsWithOverrides: wrapDefaultObject({} as any),
lastBlueprintConfig: undefined,
}

describe('Service messages internal API', () => {
Expand Down
38 changes: 20 additions & 18 deletions meteor/server/__tests__/cronjobs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import '../../__mocks__/_extendJest'
import { runAllTimers, waitUntil } from '../../__mocks__/helpers/jest'
import { MeteorMock } from '../../__mocks__/meteor'
import { logger } from '../logging'
import { getRandomId, getRandomString, protectString } from '../lib/tempLib'
import { getRandomId, getRandomString, literal, protectString } from '../lib/tempLib'
import { SnapshotType } from '@sofie-automation/meteor-lib/dist/collections/Snapshots'
import { IBlueprintPieceType, PieceLifespan, StatusCode, TSR } from '@sofie-automation/blueprints-integration'
import {
Expand Down Expand Up @@ -64,26 +64,36 @@ import {
import { DBSegment } from '@sofie-automation/corelib/dist/dataModel/Segment'
import { Settings } from '../Settings'
import { SofieIngestCacheType } from '@sofie-automation/corelib/dist/dataModel/SofieIngestDataCache'
import { ObjectOverrideSetOp } from '@sofie-automation/corelib/dist/settings/objectWithOverrides'

describe('cronjobs', () => {
let env: DefaultEnvironment
let rundownId: RundownId

beforeAll(async () => {
env = await setupDefaultStudioEnvironment()

const o = await setupDefaultRundownPlaylist(env)
rundownId = o.rundownId

async function setCasparCGCronEnabled(enabled: boolean) {
await CoreSystem.updateAsync(
{},
{
$set: {
'cron.casparCGRestart.enabled': true,
// This is a little bit of a hack, as it will result in duplicate ops, but it's fine for unit tests
$push: {
'settingsWithOverrides.overrides': literal<ObjectOverrideSetOp>({
op: 'set',
path: 'cron.casparCGRestart.enabled',
value: enabled,
}),
},
},
{ multi: true }
)
}

beforeAll(async () => {
env = await setupDefaultStudioEnvironment()

const o = await setupDefaultRundownPlaylist(env)
rundownId = o.rundownId

await setCasparCGCronEnabled(true)

jest.useFakeTimers()
// set time to 2020/07/19 00:00 Local Time
Expand Down Expand Up @@ -597,15 +607,7 @@ describe('cronjobs', () => {
})
test('Does not attempt to restart CasparCG when job is disabled', async () => {
await createMockPlayoutGatewayAndDevices(Date.now()) // Some time after the threshold
await CoreSystem.updateAsync(
{},
{
$set: {
'cron.casparCGRestart.enabled': false,
},
},
{ multi: true }
)
await setCasparCGCronEnabled(false)
;(logger.info as jest.Mock).mockClear()
// set time to 2020/07/{date} 04:05 Local Time, should be more than 24 hours after 2020/07/19 00:00 UTC
mockCurrentTime = new Date(2020, 6, date++, 4, 5, 0).getTime()
Expand Down
3 changes: 0 additions & 3 deletions meteor/server/api/blueprints/__tests__/api.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ describe('Test blueprint management api', () => {
showStyleConfigSchema: JSONBlobStringify({}),

databaseVersion: {
showStyle: {},
studio: {},
system: undefined,
},

Expand Down Expand Up @@ -238,7 +236,6 @@ describe('Test blueprint management api', () => {
TSRVersion: '0.0.0',

// studioConfigManifest: [],
// studioMigrations: [],
// getBaseline: (context: IStudioContext): TSRTimelineObjBase[] => {
// return []
// },
Expand Down
3 changes: 0 additions & 3 deletions meteor/server/api/blueprints/__tests__/lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ export function generateFakeBlueprint(
integrationVersion: '0.0.0',
TSRVersion: '0.0.0',
studioConfigManifest: [],
studioMigrations: [],
getBaseline: () => {
return {
timelineObjects: [],
Expand All @@ -43,8 +42,6 @@ export function generateFakeBlueprint(
showStyleConfigSchema: JSONBlobStringify({}),

databaseVersion: {
showStyle: {},
studio: {},
system: undefined,
},

Expand Down
Loading

0 comments on commit 0b5412a

Please sign in to comment.