Skip to content

Commit 5bf1ee3

Browse files
committed
Add lastSeenAt to device and snapshot creation in e2e tests for better timestamp tracking
1 parent b86e18a commit 5bf1ee3

4 files changed

Lines changed: 14 additions & 14 deletions

File tree

test/e2e/frontend/environments/standard.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -191,26 +191,26 @@ module.exports = async function (settings = {}, config = {}) {
191191
}
192192

193193
// Unassigned devices
194-
await factory.createDevice({ name: 'team2-unassigned-device', type: 'type2' }, team2)
195-
await factory.createDevice({ name: 'team2-unassigned-device-bulk-test-1', type: 'type2' }, team2)
194+
await factory.createDevice({ name: 'team2-unassigned-device', type: 'type2', lastSeenAt: Date.now() }, team2)
195+
await factory.createDevice({ name: 'team2-unassigned-device-bulk-test-1', type: 'type2', lastSeenAt: Date.now() }, team2)
196196

197197
// Application and Instances
198198
const application2 = await factory.createApplication({ name: 'application-2' }, team2, stack, template, projectType)
199199
await factory.createInstance({ name: 'instance-2-1' }, application2, stack, template, projectType)
200200

201201
const instanceWithDevices = await factory.createInstance({ name: 'instance-2-with-devices' }, application2, stack, template, projectType, { start: false })
202-
await factory.createDevice({ name: 'assigned-device-a', type: 'type2' }, team2, instanceWithDevices)
203-
await factory.createDevice({ name: 'assigned-device-b', type: 'type2' }, team2, instanceWithDevices)
204-
await factory.createDevice({ name: 'assigned-device-c', type: 'type2' }, team2, instanceWithDevices)
205-
await factory.createDevice({ name: 'assigned-device-d-bulk-test-2', type: 'type2' }, team2, instanceWithDevices)
202+
await factory.createDevice({ name: 'assigned-device-a', type: 'type2', lastSeenAt: Date.now() }, team2, instanceWithDevices)
203+
await factory.createDevice({ name: 'assigned-device-b', type: 'type2', lastSeenAt: Date.now() }, team2, instanceWithDevices)
204+
await factory.createDevice({ name: 'assigned-device-c', type: 'type2', lastSeenAt: Date.now() }, team2, instanceWithDevices)
205+
await factory.createDevice({ name: 'assigned-device-d-bulk-test-2', type: 'type2', lastSeenAt: Date.now() }, team2, instanceWithDevices)
206206
await factory.createSnapshot({ name: 'snapshot 1' }, instanceWithDevices, userBob)
207207
await factory.createSnapshot({ name: 'snapshot 2' }, instanceWithDevices, userBob)
208208
await factory.createSnapshot({ name: 'snapshot 3' }, instanceWithDevices, userBob)
209209

210210
// create devices bound to application directly
211-
const deviceA = await factory.createDevice({ name: 'application-device-a', type: 'type2' }, team2, null, application2)
212-
const deviceB = await factory.createDevice({ name: 'application-device-b', type: 'type2' }, team2, null, application2)
213-
await factory.createDevice({ name: 'application-device-c-bulk-test-3', type: 'type2' }, team2, null, application2)
211+
const deviceA = await factory.createDevice({ name: 'application-device-a', type: 'type2', lastSeenAt: Date.now() }, team2, null, application2)
212+
const deviceB = await factory.createDevice({ name: 'application-device-b', type: 'type2', lastSeenAt: Date.now() }, team2, null, application2)
213+
await factory.createDevice({ name: 'application-device-c-bulk-test-3', type: 'type2', lastSeenAt: Date.now() }, team2, null, application2)
214214

215215
// create a device group and add deviceB to it
216216
const deviceGroupA = await factory.createApplicationDeviceGroup({ name: 'application-device-group-a' }, application2)

test/e2e/frontend/lib/rbacTeamFactory.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,8 @@ module.exports = async function (forge) {
172172
// Create devices
173173
const appDevice = await factory.createDevice({
174174
name: `${name}-app-device`,
175-
type: 'type2'
175+
type: 'type2',
176+
lastSeenAt: Date.now()
176177
}, rbacTeam, null, application)
177178

178179
const instanceDevice = await factory.createDevice({
@@ -182,7 +183,7 @@ module.exports = async function (forge) {
182183

183184
// Create snapshots
184185
await factory.createSnapshot({ name: 'snapshot 1' }, instance, ownerOwen)
185-
await factory.createDeviceSnapshot({ name: 'device snapshot 1' }, appDevice, ownerOwen)
186+
await factory.createDeviceSnapshot({ name: 'device snapshot 1', lastSeenAt: Date.now() }, appDevice, ownerOwen)
186187

187188
// create Device Groups
188189
await factory.createApplicationDeviceGroup({

test/e2e/frontend/test_environment_ee.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ if (fs.existsSync(configPath)) {
158158

159159
// create a snapshot on DeviceB
160160
const deviceB = flowforge.applicationDevices.find((device) => device.name === 'application-device-b')
161-
await factory.createDeviceSnapshot({ name: 'application-device-b snapshot 1' }, deviceB, userTerry)
161+
await factory.createDeviceSnapshot({ name: 'application-device-b snapshot 1', lastSeenAt: Date.now() }, deviceB, userTerry)
162162

163163
rbacTeamFactory(flowforge)
164164

test/lib/TestModelFactory.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,7 @@ module.exports = class TestModelFactory {
208208
name: 'unnamed-device',
209209
type: 'unnamed-type',
210210
credentialSecret: '',
211-
agentVersion: '1.11.0',
212-
lastSeenAt: Date.now()
211+
agentVersion: '1.11.0'
213212
}
214213
const device = await this.forge.db.models.Device.create({
215214
...defaultDeviceDetails,

0 commit comments

Comments
 (0)