Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add API for creating test result via global data store #103

Merged
merged 8 commits into from
Nov 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 94 additions & 0 deletions apis/datastore.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
{
"openapi": "3.0.0",
"info": {
"description": "A service that orchestrates the Sauce cloud as well as test runner packages.",
"version": "0.1.7",
"title": "Testrunner Data Store Job Orchestrator",
"termsOfService": "https://saucelabs.com/terms-of-service",
"contact": {
"name": "Open Source Program Office at Sauce",
"email": "[email protected]",
"url": "https://saucelabs.com"
}
},
"externalDocs": {
"description": "Sauce Labs Wiki",
"url": "https://wiki.saucelabs.com"
},
"basePath": "/v1/test-results",
"servers": [
{
"url": "https://api.{region}.saucelabs.{tld}",
"variables": {
"region": {
"default": "us-west-1",
"description": "region of datacenter",
"enum": [
"us-west-1",
"eu-central-1",
"staging"
]
},
"tld": {
"default": "com",
"description": "internal or external API",
"enum": [
"net",
"com"
]
}
}
}
],
"components": {
"securitySchemes": {
"bearerAuth": {
"type": "http",
"scheme": "bearer",
"bearerFormat": "JWT"
},
"basicAuth": {
"type": "http",
"scheme": "basic"
}
}
},
"paths": {
"/": {
"post": {
"description": "create test result job via data store",
"operationId": "createResultJob",
"parameters": [
{
"in": "body",
"name": "parameters",
"required": true,
"description": "create test result job request body",
"schema": {
"type": "string"
}
}
],
"externalDocs": {
"description": "TBD",
"url": "https://wiki.saucelabs.com"
},
"tags": [
"Job"
],
"responses": {
"200": {
"description": "create test result job",
"content": {
"application/json": {
"schema": {
"type": "json"
}
}
}
}
}
}
}
}
}
4 changes: 2 additions & 2 deletions src/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ export const run = () => {
yargs.positional(param.name, paramDescription)
}
}, async (argv) => {
const { user, key, headless, region, proxy } = Object.assign({}, DEFAULT_OPTIONS, argv)
const api = new SauceLabs({ user, key, headless, region, proxy })
const { user, key, headless, region, proxy, tld } = Object.assign({}, DEFAULT_OPTIONS, argv)
const api = new SauceLabs({ user, key, headless, region, proxy, tld })
const requiredParams = params.filter((p) => p.required).map((p) => argv[p.name])

try {
Expand Down
4 changes: 2 additions & 2 deletions src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ const protocols = [
require('../apis/sauce.json'),
require('../apis/rdc.json'),
require('../apis/performance.json'),
require('../apis/testrunner.json')
require('../apis/testrunner.json'),
require('../apis/datastore.json')
]

const protocolFlattened = new Map()
Expand All @@ -31,7 +32,6 @@ for (const { paths, parameters, basePath, servers } of protocols) {
for (const [endpoint, methods] of Object.entries(paths)) {
for (const [method, description] of Object.entries(methods)) {
let commandName = camelCase(description.operationId)

/**
* mark commands as depcrecated in the command names
*/
Expand Down