Skip to content
Closed
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
2 changes: 1 addition & 1 deletion sdk/eventhub/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ extends:
template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml
parameters:
ServiceDirectory: eventhub
RunUnitTests: false
RunUnitTests: true
Artifacts:
- name: azure-event-hubs
safeName: azureeventhubs
Expand Down
3 changes: 2 additions & 1 deletion sdk/eventhub/event-hubs/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ module.exports = function(config) {
envPreprocessor: [
"EVENTHUB_CONNECTION_STRING",
"EVENTHUB_NAME",
"IOTHUB_EH_COMPATIBLE_CONNECTION_STRING"
"IOTHUB_EH_COMPATIBLE_CONNECTION_STRING",
"TEST_TARGET=live"
],

// test results reporter to use
Expand Down
10 changes: 7 additions & 3 deletions sdk/eventhub/event-hubs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
}
},
"browser": {
"./dist-esm/src/util/runtimeInfo.js": "./dist-esm/src/util/runtimeInfo.browser.js"
"./dist-esm/src/util/runtimeInfo.js": "./dist-esm/src/util/runtimeInfo.browser.js",
"./dist-esm/test/public/utils/mockService.js": "./dist-esm/test/public/utils/mockService.browser.js"
},
"files": [
"dist/",
Expand All @@ -57,8 +58,9 @@
"execute:samples": "npm run build:samples && echo Skipped.",
"extract-api": "tsc -p . && api-extractor run --local",
"format": "prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"",
"generate-certs": "node ./scripts/generateCerts.js",
"integration-test:browser": "karma start --single-run",
"integration-test:node": "nyc mocha -r esm --require source-map-support/register --reporter ../../../common/tools/mocha-multi-reporter.js --timeout 1200000 --full-trace \"dist-esm/test/internal/*.spec.js\" \"dist-esm/test/public/*.spec.js\" \"dist-esm/test/public/**/*.spec.js\" \"dist-esm/test/internal/**/*.spec.js\"",
"integration-test:node": "cross-env TEST_TARGET=live nyc mocha -r esm --require source-map-support/register --reporter ../../../common/tools/mocha-multi-reporter.js --timeout 1200000 --full-trace \"dist-esm/test/internal/*.spec.js\" \"dist-esm/test/public/*.spec.js\" \"dist-esm/test/public/**/*.spec.js\" \"dist-esm/test/internal/**/*.spec.js\"",
"integration-test": "npm run integration-test:node && npm run integration-test:browser",
"lint:fix": "eslint package.json api-extractor.json src test --ext .ts --fix --fix-type [problem,suggestion]",
"lint": "eslint package.json api-extractor.json src test --ext .ts",
Expand All @@ -69,7 +71,7 @@
"test:node": "npm run build:test && npm run unit-test:node && npm run integration-test:node",
"test": "npm run build:test && npm run unit-test && npm run integration-test",
"unit-test:browser": "echo skipped",
"unit-test:node": "echo skipped",
"unit-test:node": "npm run generate-certs && cross-env NODE_EXTRA_CA_CERTS=\"./certs/my-private-root-ca.crt.pem\" TEST_TARGET=mock nyc mocha -r esm --require source-map-support/register --reporter ../../../common/tools/mocha-multi-reporter.js --timeout 1200000 --full-trace \"dist-esm/test/internal/*.spec.js\" \"dist-esm/test/public/*.spec.js\" \"dist-esm/test/public/**/*.spec.js\" \"dist-esm/test/internal/**/*.spec.js\"",
"unit-test": "npm run unit-test:node && npm run unit-test:browser",
"docs": "typedoc --excludePrivate --excludeNotExported --excludeExternals --stripInternal --mode file --out ./dist/docs ./src"
},
Expand Down Expand Up @@ -107,6 +109,8 @@
"@azure/dev-tool": "^1.0.0",
"@azure/eslint-plugin-azure-sdk": "^3.0.0",
"@azure/identity": "^1.1.0",
"@azure/mock-hub": "^1.0.0",
"@azure/test-utils-multi-version": "^1.0.0",
"@azure/test-utils-perfstress": "^1.0.0",
"@microsoft/api-extractor": "7.7.11",
"@rollup/plugin-commonjs": "11.0.2",
Expand Down
82 changes: 82 additions & 0 deletions sdk/eventhub/event-hubs/scripts/generateCerts.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

const { execFileSync } = require("child_process");
const { mkdirSync } = require("fs");
const { resolve: resolvePath } = require("path");

const cwd = process.cwd();
const certsDirectory = resolvePath(cwd, "certs");

// Create `certs` directory.
console.log(`Creating ${certsDirectory}`);
try {
mkdirSync(certsDirectory);
} catch (err) {
if (err.code !== "EEXIST") {
throw err;
}
}

// Create own Root Certificate Authority
execFileSync("openssl", [
"genrsa",
"-out",
`${resolvePath(certsDirectory, "my-private-root-ca.key.pem")}`,
"2048"
]);

// Self-sign Root Certificate Authority
execFileSync("openssl", [
"req",
"-x509",
"-new",
"-nodes",
"-key",
`${resolvePath(certsDirectory, "my-private-root-ca.key.pem")}`,
"-days",
"5",
"-out",
`${resolvePath(certsDirectory, "my-private-root-ca.crt.pem")}`,
"-subj",
"/C=US/ST=Washington/L=Seattle/O=Fake Signing Authority/CN=fake.foo"
]);

// Create a certificate for localhost
execFileSync("openssl", [
"genrsa",
"-out",
`${resolvePath(certsDirectory, "my-server.key.pem")}`,
"2048"
]);

// Create a request which the Root Certificate Authority will sign
execFileSync("openssl", [
"req",
"-new",
"-key",
`${resolvePath(certsDirectory, "my-server.key.pem")}`,
"-out",
`${resolvePath(certsDirectory, "my-server.csr.pem")}`,
"-subj",
"/C=US/ST=Washington/L=Seattle/O=Fake Hubs/CN=localhost"
]);

// Sign the request with the Root Certificate Authority
execFileSync("openssl", [
"x509",
"-req",
"-in",
`${resolvePath(certsDirectory, "my-server.csr.pem")}`,
"-CA",
`${resolvePath(certsDirectory, "my-private-root-ca.crt.pem")}`,
"-CAkey",
`${resolvePath(certsDirectory, "my-private-root-ca.key.pem")}`,
"-CAcreateserial",
"-out",
`${resolvePath(certsDirectory, "my-server.crt.pem")}`,
"-days",
"5"
]);

console.log(`Certs created.`);
Loading