Compare commits

..

1 Commits

Author SHA1 Message Date
Ashwin Kumar M
02cfe0945e Set environment variable in the secrets to access the connection string in the secrets folder 2020-06-05 18:41:05 -07:00
8 changed files with 146 additions and 29 deletions

View File

@@ -67,6 +67,136 @@ jobs:
EMULATOR_ENDPOINT: https://0.0.0.0:8081/
NODE_TLS_REJECT_UNAUTHORIZED: 0
CYPRESS_CACHE_FOLDER: ~/.cache/Cypress
endtoendprodsql:
name: "End to End Tests Prod"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js 12.x
uses: actions/setup-node@v1
with:
node-version: 12.x
- name: Restore Cypress Binary Cache
uses: actions/cache@v2
with:
path: ~/.cache/Cypress
key: ${{ runner.os }}-cypress-binary-cache
- name: End to End Tests
run: |
npm ci
npm start &
npm ci --prefix ./cypress
npm run test --prefix ./cypress
shell: bash
env:
EMULATOR_ENDPOINT: https://0.0.0.0:8081/
NODE_TLS_REJECT_UNAUTHORIZED: 0
CYPRESS_CACHE_FOLDER: ~/.cache/Cypress
CONNECTION_STRING: ${{ secrets.CONNECTION_STRING_SQL }}
endtoendprodmongo:
name: "End to End Tests Prod"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js 12.x
uses: actions/setup-node@v1
with:
node-version: 12.x
- name: Restore Cypress Binary Cache
uses: actions/cache@v2
with:
path: ~/.cache/Cypress
key: ${{ runner.os }}-cypress-binary-cache
- name: End to End Tests
run: |
npm ci
npm start &
npm ci --prefix ./cypress
npm run test --prefix ./cypress
shell: bash
env:
EMULATOR_ENDPOINT: https://0.0.0.0:8081/
NODE_TLS_REJECT_UNAUTHORIZED: 0
CYPRESS_CACHE_FOLDER: ~/.cache/Cypress
CONNECTION_STRING: ${{ secrets.CONNECTION_STRING_MONGO }}
endtoendprodtable:
name: "End to End Tests Prod"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js 12.x
uses: actions/setup-node@v1
with:
node-version: 12.x
- name: Restore Cypress Binary Cache
uses: actions/cache@v2
with:
path: ~/.cache/Cypress
key: ${{ runner.os }}-cypress-binary-cache
- name: End to End Tests
run: |
npm ci
npm start &
npm ci --prefix ./cypress
npm run test --prefix ./cypress
shell: bash
env:
EMULATOR_ENDPOINT: https://0.0.0.0:8081/
NODE_TLS_REJECT_UNAUTHORIZED: 0
CYPRESS_CACHE_FOLDER: ~/.cache/Cypress
CONNECTION_STRING: ${{ secrets.CONNECTION_STRING_TABLE }}
endtoendprodgraph:
name: "End to End Tests Prod"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js 12.x
uses: actions/setup-node@v1
with:
node-version: 12.x
- name: Restore Cypress Binary Cache
uses: actions/cache@v2
with:
path: ~/.cache/Cypress
key: ${{ runner.os }}-cypress-binary-cache
- name: End to End Tests
run: |
npm ci
npm start &
npm ci --prefix ./cypress
npm run test --prefix ./cypress
shell: bash
env:
EMULATOR_ENDPOINT: https://0.0.0.0:8081/
NODE_TLS_REJECT_UNAUTHORIZED: 0
CYPRESS_CACHE_FOLDER: ~/.cache/Cypress
CONNECTION_STRING: ${{ secrets.CONNECTION_STRING_GRAPH }}
endtoendprodcassandra:
name: "End to End Tests Prod"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js 12.x
uses: actions/setup-node@v1
with:
node-version: 12.x
- name: Restore Cypress Binary Cache
uses: actions/cache@v2
with:
path: ~/.cache/Cypress
key: ${{ runner.os }}-cypress-binary-cache
- name: End to End Tests
run: |
npm ci
npm start &
npm ci --prefix ./cypress
npm run test --prefix ./cypress
shell: bash
env:
EMULATOR_ENDPOINT: https://0.0.0.0:8081/
NODE_TLS_REJECT_UNAUTHORIZED: 0
CYPRESS_CACHE_FOLDER: ~/.cache/Cypress
CONNECTION_STRING: ${{ secrets.CONNECTION_STRING_CASSANDRA }}
nuget:
name: Publish Nuget
needs: [build, test, endtoend]

View File

@@ -24,7 +24,7 @@ module.exports = {
.last()
.click({ force: true });
const secret = Cypress.env('connectionString')[api];
const secret = Cypress.env(`CONNECTION_STRING_${api && api.toUpperCase()}`);
cy.wrap($body)
.find("input[class='inputToken']")

15
package-lock.json generated
View File

@@ -5,9 +5,9 @@
"requires": true,
"dependencies": {
"@azure/cosmos": {
"version": "3.7.0",
"resolved": "https://registry.npmjs.org/@azure/cosmos/-/cosmos-3.7.0.tgz",
"integrity": "sha512-3SRxnmy6NncdX5eYqGuRTack52hloS9YhQ0aOKwWJ8Z4dDSrVH3XB2Mcp/WokoIpVm0Bq5nUC8FsvLBZKfRkyg==",
"version": "3.6.3",
"resolved": "https://registry.npmjs.org/@azure/cosmos/-/cosmos-3.6.3.tgz",
"integrity": "sha512-JoCDxl0TnL6EHL4xD3KC9r2bMivK13q1jl7h69wd/YFLlt3aBTTCehtAX+y4alNSENpL53XdRdw/cna0mI2XDw==",
"requires": {
"@types/debug": "^4.1.4",
"debug": "^4.1.1",
@@ -18,14 +18,7 @@
"priorityqueuejs": "^1.0.0",
"semaphore": "^1.0.5",
"tslib": "^1.10.0",
"uuid": "^8.1.0"
},
"dependencies": {
"uuid": {
"version": "8.1.0",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.1.0.tgz",
"integrity": "sha512-CI18flHDznR0lq54xBycOVmphdCYnQLKn8abKn7PXUiKUGdEd+/l9LWNJmugXel4hXq7S+RMNl34ecyC9TntWg=="
}
"uuid": "^3.3.2"
}
},
"@azure/cosmos-language-service": {

View File

@@ -4,7 +4,7 @@
"description": "Cosmos Explorer",
"main": "index.js",
"dependencies": {
"@azure/cosmos": "3.7.0",
"@azure/cosmos": "3.6.3",
"@azure/cosmos-language-service": "0.0.4",
"@jupyterlab/services": "4.2.0",
"@jupyterlab/terminal": "1.2.1",

View File

@@ -21,15 +21,13 @@ const _global = typeof self === "undefined" ? window : self;
export const tokenProvider = async (requestInfo: RequestInfo) => {
const { verb, resourceId, resourceType, headers } = requestInfo;
if (config.platform === Platform.Emulator) {
// TODO This SDK method mutates the headers object. Find a better one or fix the SDK.
await setAuthorizationTokenHeaderUsingMasterKey(verb, resourceId, resourceType, headers, EmulatorMasterKey);
return decodeURIComponent(headers.authorization);
// TODO Remove any. SDK expects a return value for tokenProvider, but we are mutating the header object instead.
return setAuthorizationTokenHeaderUsingMasterKey(verb, resourceId, resourceType, headers, EmulatorMasterKey) as any;
}
if (_masterKey) {
// TODO This SDK method mutates the headers object. Find a better one or fix the SDK.
await setAuthorizationTokenHeaderUsingMasterKey(verb, resourceId, resourceType, headers, EmulatorMasterKey);
return decodeURIComponent(headers.authorization);
// TODO Remove any. SDK expects a return value for tokenProvider, but we are mutating the header object instead.
return setAuthorizationTokenHeaderUsingMasterKey(verb, resourceId, resourceType, headers, _masterKey) as any;
}
if (_resourceToken) {
@@ -49,9 +47,7 @@ export const requestPlugin: Cosmos.Plugin<any> = async (requestContext, next) =>
export const endpoint = () => {
if (config.platform === Platform.Emulator) {
// In worker scope, _global(self).parent does not exist
const location = _global.parent ? _global.parent.location : _global.location;
return config.EMULATOR_ENDPOINT || location.origin;
return config.EMULATOR_ENDPOINT || window.parent.location.origin;
}
return _endpoint || (_databaseAccount && _databaseAccount.properties && _databaseAccount.properties.documentEndpoint);
};

View File

@@ -32,7 +32,6 @@ import DocumentId from "./DocumentId";
import StoredProcedure from "./StoredProcedure";
import Trigger from "./Trigger";
import UserDefinedFunction from "./UserDefinedFunction";
import { config } from "../../Config";
export default class Collection implements ViewModels.Collection {
public nodeKind: string;
@@ -1417,7 +1416,7 @@ export default class Collection implements ViewModels.Collection {
masterKey: CosmosClient.masterKey(),
endpoint: CosmosClient.endpoint(),
accessToken: CosmosClient.accessToken(),
platform: config.platform,
platform: window.dataExplorerPlatform,
databaseAccount: CosmosClient.databaseAccount()
}
};

View File

@@ -1,5 +1,5 @@
import { DatabaseAccount } from "../../Contracts/DataModels";
import { Platform } from "../../Config";
import { PlatformType } from "../../PlatformType";
export interface StartUploadMessageParams {
files: FileList;
@@ -12,7 +12,7 @@ export interface DocumentClientParams {
masterKey: string;
endpoint: string;
accessToken: string;
platform: Platform;
platform: PlatformType;
databaseAccount: DatabaseAccount;
}

View File

@@ -1,7 +1,6 @@
import "babel-polyfill";
import { DocumentClientParams, UploadDetailsRecord, UploadDetails } from "./definitions";
import { CosmosClient } from "../../Common/CosmosClient";
import { config } from "../../Config";
let numUploadsSuccessful = 0;
let numUploadsFailed = 0;
@@ -34,7 +33,8 @@ onmessage = (event: MessageEvent) => {
CosmosClient.endpoint(clientParams.endpoint);
CosmosClient.accessToken(clientParams.accessToken);
CosmosClient.databaseAccount(clientParams.databaseAccount);
config.platform = clientParams.platform;
self.dataExplorerPlatform = clientParams.platform;
console.log(event);
if (!!files && files.length > 0) {
numFiles = files.length;
for (let i = 0; i < numFiles; i++) {
@@ -106,7 +106,6 @@ function createDocumentsFromFile(fileName: string, documentContent: string): voi
triggerCreateDocument(content);
}
} catch (e) {
console.log(e);
recordUploadDetailErrorForFile(fileName, e.message);
transmitResultIfUploadComplete();
}