All files / lib/validation index.js

100% Statements 19/19
100% Branches 0/0
100% Functions 0/0
100% Lines 19/19

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108      1x   1x         1x         1x         1x           1x         1x       1x       1x     1x     1x     1x         1x       1x           1x           1x         1x           1x                                           1x          
"use strict";
//ID must be abc4_{provider}_..._uuid. provider is one of provider name in lower case (only aws for now).
//each provider can add some necessary info between provider name and uuid
const reID = /abc4_(aws)_.*_[\da-f]{8}-[\da-f]{4}-1[\da-f]{3}-[\da-f]{4}-[\da-f]{12}/;
 
const idSchema = {
  type: "string",
  regexp: reID.toString()
};
 
const provider = {
  type: "string",
  regexp: "/aws/i",
  transform: ["trim", "toLowerCase"]
};
const numNodes = {
  type: "integer",
  minimum: 1,
  default: 1
};
const os = {
  type: "string",
  regexp: "/(centos[67]|ubuntu(16|18))/i",
  default: "centos7",
  transform: ["trim", "toLowerCase"]
};
const rootVolume = {
  type: "number",
  minimum: 0,
  default: 0
};
const shareStorage = {
  type: "boolean",
  default: true
};
const headOnlyParam = {
  type: "object",
  default: {}
};
const publicKey = {
  type: "string"
};
const id = {
  type: "string"
};
const pw = {
  type: "string"
};
const batch = {
  type: "string",
  regexp: "/(pbspro|slurm)/i",
  transform: ["trim", "toLowerCase"]
};
const runJobOnBatchServer = {
  type: "boolean",
  default: true
};
const batchSetupScript = {
  type: "array",
  items: {
    type: "string"
  }
};
const packages = {
  type: "array",
  items: {
    type: "string"
  }
};
const mpi = {
  type: "string",
  regexp: "/(openmpi|mpich)/i",
  transform: ["trim", "toLowerCase"]
};
const compiler = {
  type: "string",
  regexp: "/(gcc|clang)/i",
  transform: ["trim", "toLowerCase"]
};
 
const orderSchema = {
  type: "object",
  required: ["provider"],
  properties: {
    provider,
    numNodes,
    os,
    rootVolume,
    shareStorage,
    headOnlyParam,
    publicKey,
    id,
    pw,
    batch,
    runJobOnBatchServer,
    batchSetupScript,
    packages,
    mpi,
    compiler
  }
};
 
module.exports = {
  reID,
  idSchema,
  orderSchema
};