-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:apigee-internal/microgateway
- Loading branch information
Showing
34 changed files
with
1,275 additions
and
298 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
MOCHA_PASSWORD=$MOCHA_PASSWORD_CFG | ||
MOCHA_KEY=$MOCHA_KEY_CFG | ||
MOCHA_SECRET=$MOCHA_SECRET_CFG | ||
MOCHA_USER=$MOCHA_USER_CFG | ||
MOCHA_ORG=$MOCHA_ORG_CFG | ||
MOCHA_ENV=$MOCHA_ENV_CFG | ||
MOCHA_TOKEN_SECRET=$MOCHA_TOKEN_SECRET_CFG | ||
MOCHA_TOKEN_ID=$MOCHA_TOKEN_ID_CFG | ||
MOCHA_SAML_TOKEN=$MOCHA_SAML_TOKEN_CFG | ||
MOCHA_ENDPOINT=$MOCHA_ENDPOINT_CFG |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,3 +32,4 @@ headers: | |
oauth: | ||
allowNoAuthorization: false | ||
allowInvalidAuthorization: false | ||
gracePeriod: 10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// gateway.test.js | ||
|
||
'use strict'; | ||
|
||
const gateway = require('../cli/lib/gateway.js')(); | ||
const assert = require('assert'); | ||
const path = require('path'); | ||
const denv = require('dotenv'); | ||
denv.config(); | ||
const envVars = require('./env.js'); | ||
const {user:username, password, env, org, tokenId:id, tokenSecret, key, secret } = envVars; | ||
const { spawn, spawnSync, execSync } = require("child_process"); | ||
|
||
describe('gateway module', () => { | ||
|
||
it('starts mgw', (done) => { | ||
let gatewayStart = spawn('node', ['tests/childProcs/gatewayStart.test.js']); | ||
|
||
let outData = []; | ||
gatewayStart.stdout.on('data', data=>{ | ||
outData.push(data); | ||
let outDataStr = Buffer.concat(outData).toString(); | ||
if(outDataStr.includes('PROCESS PID :')) { | ||
outData = []; | ||
done(); | ||
} | ||
}); | ||
|
||
gatewayStart.stderr.on('data', errData =>{ | ||
console.log('errData',Buffer.from(errData).toString()); | ||
}); | ||
}); | ||
|
||
it('provides mgw status when running',(done) => { | ||
let gatewayStatus = spawnSync('node', ['tests/childProcs/gatewayStatus.test.js']); | ||
let outString = Buffer.from(gatewayStatus.stdout).toString(); | ||
assert.equal(outString.includes('edgemicro is running with'), true) | ||
done(); | ||
}); | ||
|
||
it('reloads mgw when running', (done) => { | ||
let gatewayReload = spawnSync('node', ['tests/childProcs/gatewayReload.test.js']); | ||
let outString = Buffer.from(gatewayReload.stdout).toString(); | ||
assert.equal(outString.includes('Reload Completed Successfully'), true); | ||
done(); | ||
}); | ||
|
||
it('stop mgw when running', done=> { | ||
let gatewayStop = spawnSync('node', ['tests/childProcs/gatewayStop.test.js']); | ||
let outString = Buffer.from(gatewayStop.stdout).toString(); | ||
assert.equal(outString.includes('Stop Completed Succesfully'), true); | ||
done(); | ||
}); | ||
|
||
}); |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
|
||
edge_config: | ||
bootstrap: https://apigee.net/edgemicro/bootstrap/organization/org/environment/env... | ||
jwt_public_key: http://apigee.net/edgemicro/publicKey... | ||
managementUri: https://api.enterprise.apigee.com | ||
vaultName: microgateway | ||
authUri: https://%s-%s.apigee.net/edgemicro-auth | ||
baseUri: https://edgemicroservices.apigee.net/edgemicro/%s/organization/%s/environment/%s | ||
bootstrapMessage: Please copy the following property to the edge micro agent config | ||
keySecretMessage: The following credentials are required to start edge micro | ||
|
||
edgemicro: | ||
port: 8000 | ||
max_connections: 1000 | ||
config_change_poll_interval: 600 | ||
logging: | ||
level: error | ||
dir: /var/tmp | ||
stats_log_interval: 60 | ||
rotate_interval: 24 | ||
plugins: | ||
sequence: | ||
- oauth | ||
|
||
headers: | ||
x-forwarded-for: true | ||
x-forwarded-host: true | ||
x-request-id: true | ||
x-response-time: true | ||
via: true | ||
|
||
oauth: | ||
allowNoAuthorization: false | ||
allowInvalidAuthorization: false | ||
gracePeriod: 600 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
const assert = require('assert'); | ||
|
||
const password = process.env.MOCHA_PASSWORD; | ||
const key = process.env.MOCHA_KEY; | ||
const secret = process.env.MOCHA_SECRET; | ||
const user = process.env.MOCHA_USER; | ||
const org = process.env.MOCHA_ORG; | ||
const env = process.env.MOCHA_ENV; | ||
const tokenSecret = process.env.MOCHA_TOKEN_SECRET; | ||
const tokenId = process.env.MOCHA_TOKEN_ID; | ||
const otoken = process.env.MOCHA_SAML_TOKEN || ''; | ||
const endpoint = process.env.MOCHA_ENDPOINT || false; | ||
|
||
|
||
assert(password, 'Must set environment variable MOCHA_PASSWORD'); | ||
assert(user, 'Must set environment variable MOCHA_USER'); | ||
assert(org, 'Must set environment variable MOCHA_ORG'); | ||
assert(env, 'Must set environment variable MOCHA_ENV'); | ||
assert(key, 'Must set environment variable MOCHA_KEY'); | ||
assert(secret, 'Must set environment variable MOCHA_SECRET'); | ||
assert(tokenId, 'Must set environment variable MOCHA_TOKEN_ID'); | ||
assert(tokenSecret, 'Must set environment variable MOCHA_TOKEN_SECRET'); | ||
|
||
module.exports = { | ||
password:password, | ||
key:key, | ||
secret:secret, | ||
user:user, | ||
org:org, | ||
env:env, | ||
tokenSecret:tokenSecret, | ||
tokenId:tokenId, | ||
otoken:otoken, | ||
endpoint : endpoint | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
eyJraWQiOiIxIiwidHlwIjoiSldUIiwiYWxnIjoiUlMyNTYifQ.eyJhY2Nlc3NfdG9rZW4iOiJGSk9rZW5OV0sxWkw4RThOc2U1eFRSSU9pdDVkIiwiYXVkIjoibWljcm9nYXRld2F5IiwibmJmIjoxNTU5OTQzMzIzLCJhcGlfcHJvZHVjdF9saXN0IjpbImJha2VyeXRyaWFsIl0sImFwcGxpY2F0aW9uX25hbWUiOiJCYWtlcnlBcHAiLCJkZXZlbG9wZXJfZW1haWwiOiJoZWxsb3dvcmxkQGFwaWdlZS5jb20iLCJpc3MiOiJodHRwczovL2xlZGR5ci1ldmFsLXRlc3QuYXBpZ2VlLm5ldC9lZGdlbWljcm8tYXV0aC90b2tlbiIsImV4cCI6MTU1OTk0MzQzMSwiaWF0IjoxNTU5OTQzMzIzLCJqdGkiOiIyNDc3MTVjNC0yOTQ4LTQxNjUtODk5OS04N2JhYmU4NjM0YTIiLCJjbGllbnRfaWQiOiJkMHd6NXBWQm9VWnd6cVJVRXMzQTlFc3VBbVUyb2YyaCJ9.ppkYhO_hIWL2rgHoLvLIfPcd10NOk8Ie5MrhlhjsyEeWV_tHS8eGV7V8zHDixCsMJ9FH3DeoIYmaJxfRUQRlrXw40u2famu0sdTy4Is9Wi7vaYAp7xXBr9gv6JPMgojcIhnQEzWGiQcsnIgBl2qQ5D8BTvvT0CvWv3XHvKB6qJMGTCrykjhRNt1-z_qTMEOUgvlccpnJ_FQlg1Fyst3Rhoegoe32cws8s9sFI0-5li9WAO6UMP2VJLx1PGE51oBJX1OuBDTG8UH8Igjt5q5-v9F2U6Md7caLbRG7Ynz4wAJPTRCKXYeLr9PQsmzm5jdUA4HY7HSVrjfBNUe5l3c2Fg |
Oops, something went wrong.