mirror of
https://github.com/DeviceFarmer/stf.git
synced 2026-04-18 08:13:31 +02:00
improve device state consistency (#831)
Signed-off-by: Denis barbaron <denis.barbaron@orange.com> Co-authored-by: Karol Wrótniak <karol.wrotniak@droidsonroids.pl>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright © 2019 contains code contributed by Orange SA, authors: Denis Barbaron - Licensed under the Apache license 2.0
|
||||
* Copyright © 2019-2025 contains code contributed by Orange SA, authors: Denis Barbaron - Licensed under the Apache license 2.0
|
||||
**/
|
||||
|
||||
var util = require('util')
|
||||
@@ -10,6 +10,8 @@ var _ = require('lodash')
|
||||
var dbapi = require('../db/api')
|
||||
var devices = require('@devicefarmer/stf-device-db/dist/devices-latest')
|
||||
|
||||
const timeutil = require('./timeutil')
|
||||
|
||||
module.exports.generate = function(wantedModel) {
|
||||
// no base64 because some characters as '=' or '/' are not compatible through API (delete devices)
|
||||
const serial = 'fake-' + util.format('%s', uuid.v4()).replace(/-/g, '')
|
||||
@@ -20,6 +22,7 @@ module.exports.generate = function(wantedModel) {
|
||||
, channel: '*fake'
|
||||
}
|
||||
, status: 'OFFLINE'
|
||||
, statusTimeStamp: timeutil.now('nano')
|
||||
})
|
||||
.then(function() {
|
||||
var model = wantedModel || _.sample(Object.keys(devices))
|
||||
|
||||
Reference in New Issue
Block a user