Skip to content

Commit

Permalink
Merge pull request #142 from thiagobustamante/master
Browse files Browse the repository at this point in the history
Remove test dependency with httpbin.org, running httpbin in a docker …
  • Loading branch information
thiagobustamante committed May 27, 2018
2 parents 9ba549c + 620292d commit 2cf7cb0
Show file tree
Hide file tree
Showing 29 changed files with 39 additions and 39 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ services:
- docker
before_install:
- docker run -p 6379:6379 -d --name tree_redis redis:3.0.7-alpine
- docker run -p 80:80 -d --name httpbin kennethreitz/httpbin
- docker run -p 8500:8500 -d --name tree_consul consul
script: nyc npm run test && nyc report --reporter=text-lcov | coveralls
deploy:
Expand Down
2 changes: 1 addition & 1 deletion src/config/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class ValidationError extends Errors.ForbidenError {
} else if (_.endsWith(e.type, 'Unknown')) {
unexpectedFields.push(e.path);
} else {
invalidFields.push(e.path);
invalidFields.push(`${e.path} (${e.context?e.context.value:''})`);
}
});

Expand Down
1 change: 0 additions & 1 deletion src/pipeline/group.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ export function buildGroupAllowTest(request: string, groups: Array<Group>, group
.map(p => `'${p}'`)
.join(',');
func.push(`(mm.all(${request}.path, [${expressions}]))`);
console.info(expressions);
} else {
func.push(`(mm.isMatch(${request}.path, '${normalizePath(path)}'))`);
}
Expand Down
2 changes: 1 addition & 1 deletion test/data/apis/authenticated.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"path": "secure/",
"proxy": {
"target": {
"host": "http://httpbin.org"
"host": "http://localhost"
},
"timeout": "fifteen seconds"
},
Expand Down
2 changes: 1 addition & 1 deletion test/data/apis/basicAuthentication.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"path": "secureBasic/",
"proxy": {
"target": {
"host": "http://httpbin.org"
"host": "http://localhost"
},
"timeout": 5000
},
Expand Down
2 changes: 1 addition & 1 deletion test/data/apis/basicAuthenticationByGroup.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
],
"proxy": {
"target": {
"host": "http://httpbin.org"
"host": "http://localhost"
},
"timeout": 5000
},
Expand Down
2 changes: 1 addition & 1 deletion test/data/apis/basicAuthenticationByGroupMultiPath.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
],
"proxy": {
"target": {
"host": "http://httpbin.org"
"host": "http://localhost"
},
"timeout": 5000
},
Expand Down
2 changes: 1 addition & 1 deletion test/data/apis/cached.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
],
"proxy": {
"target": {
"host": "http://httpbin.org"
"host": "http://localhost"
},
"timeout": 5000
},
Expand Down
2 changes: 1 addition & 1 deletion test/data/apis/circuitbreaker.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"path": "circuitbreaker/",
"proxy": {
"target": {
"host": "http://httpbin.org"
"host": "http://localhost"
}
},
"circuitBreaker": [{
Expand Down
2 changes: 1 addition & 1 deletion test/data/apis/circuitbreakerTimewindow.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"path": "circuitbreakerTime/",
"proxy": {
"target": {
"host": "http://httpbin.org"
"host": "http://localhost"
}
},
"circuitBreaker": [{
Expand Down
2 changes: 1 addition & 1 deletion test/data/apis/cors-middleware.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"path": "cors-middleware/",
"proxy": {
"target": {
"host": "http://httpbin.org"
"host": "http://localhost"
}
},
"cors" : [{
Expand Down
2 changes: 1 addition & 1 deletion test/data/apis/cors.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"path": "cors/",
"proxy": {
"target": {
"host": "http://httpbin.org"
"host": "http://localhost"
}
},
"cors" : [{
Expand Down
2 changes: 1 addition & 1 deletion test/data/apis/customAuthentication.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"path": "secureCustom/",
"proxy": {
"target": {
"host": "http://httpbin.org"
"host": "http://localhost"
},
"timeout": 5000
},
Expand Down
2 changes: 1 addition & 1 deletion test/data/apis/filtered.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
],
"proxy": {
"target": {
"host": "http://httpbin.org"
"host": "http://localhost"
},
"timeout": 5000
},
Expand Down
6 changes: 3 additions & 3 deletions test/data/apis/headerSplit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ proxy:
name: header
options:
name: authorization
defaultTarget: http://httpbin.org
defaultTarget: http://localhost
destinations:
- target: http://httpbin.org
- target: http://localhost
value: '1'
- target: http://httpbin.org/anything
- target: http://localhost/anything
value: '2'
timeout: 5000
2 changes: 1 addition & 1 deletion test/data/apis/httpbin.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
],
"proxy": {
"target": {
"host": "http://httpbin.org",
"host": "http://localhost",
"allow": ["Group1"],
"deny": "Group2"
},
Expand Down
2 changes: 1 addition & 1 deletion test/data/apis/intercepted.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
],
"proxy": {
"target": {
"host": "http://httpbin.org"
"host": "http://localhost"
},
"timeout": 5000
},
Expand Down
2 changes: 1 addition & 1 deletion test/data/apis/interceptedByDefaultMiddleware.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ group:
parseReqBody: true
proxy:
target:
host: http://httpbin.org
host: http://localhost
timeout: 5000
interceptor:
response:
Expand Down
2 changes: 1 addition & 1 deletion test/data/apis/limitedApi.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"path": "limited",
"proxy": {
"target": {
"host": "http://httpbin.org"
"host": "http://localhost"
},
"timeout": 5000
},
Expand Down
2 changes: 1 addition & 1 deletion test/data/apis/limitedApiByGroup.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
],
"proxy": {
"target": {
"host": "http://httpbin.org"
"host": "http://localhost"
},
"timeout": 5000
},
Expand Down
8 changes: 4 additions & 4 deletions test/data/apis/loadBalancer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ proxy:
name: loadBalancer
options:
destinations:
- target: http://httpbin.org
- target: http://localhost
weight: 75
healthCheck: http://httpbin.org/get
- target: http://httpbin.org/anything
healthCheck: http://localhost/get
- target: http://localhost/anything
weight: 25
healthCheck: http://httpbin.org/anything/get
healthCheck: http://localhost/anything/get
database:
checkInterval: 5 minutes
strategy: weight
Expand Down
2 changes: 1 addition & 1 deletion test/data/apis/localAuthentication.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"path": "secureLocal/",
"proxy": {
"target": {
"host": "http://httpbin.org"
"host": "http://localhost"
},
"timeout": 5000
},
Expand Down
2 changes: 1 addition & 1 deletion test/data/apis/postApi.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"parseReqBody": true,
"proxy": {
"target": {
"host": "http://httpbin.org"
"host": "http://localhost"
},
"timeout": 5000
},
Expand Down
2 changes: 1 addition & 1 deletion test/data/apis/postApiRemoveHeader.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"parseReqBody": true,
"proxy": {
"target": {
"host": "http://httpbin.org"
"host": "http://localhost"
},
"supressViaHeader": true,
"timeout": 5000
Expand Down
6 changes: 3 additions & 3 deletions test/data/apis/querySplit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ proxy:
name: query
options:
param: apiVersion
defaultTarget: http://httpbin.org
defaultTarget: http://localhost
destinations:
- target: http://httpbin.org
- target: http://localhost
value: '1'
- target: http://httpbin.org/anything
- target: http://localhost/anything
value: '2'
timeout: 5000
2 changes: 1 addition & 1 deletion test/data/apis/serviceDiscoveryConsulMiddleware.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ proxy:
name: query
options:
param: apiVersion
defaultTarget: http://httpbin.org
defaultTarget: http://localhost
destinations:
- target: testConsulService
value: '1'
Expand Down
2 changes: 1 addition & 1 deletion test/data/apis/simpleApi.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"path": "simple/",
"proxy": {
"target": {
"host": "http://httpbin.org"
"host": "http://localhost"
},
"timeout": 5000
},
Expand Down
4 changes: 2 additions & 2 deletions test/data/apis/trafficSplit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ proxy:
name: trafficSplit
options:
destinations:
- target: http://httpbin.org
- target: http://localhost
weight: 75
- target: http://httpbin.org/anything
- target: http://localhost/anything
weight: 25
timeout: 5000
8 changes: 4 additions & 4 deletions test/unit/proxy.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,11 @@ describe('The Gateway Proxy', () => {
gatewayRequest('/querySplit/get', (error: any, response: any, body: any) => {
expect(response.statusCode).to.equal(200);
const result = JSON.parse(body);
expect(result.url).to.equal('http://httpbin.org/get');
expect(result.url).to.equal('http://localhost/get');
gatewayRequest('/querySplit/get?apiVersion=2', (err: any, res: any, b: any) => {
expect(res.statusCode).to.equal(200);
const result2 = JSON.parse(b);
expect(result2.url).to.equal('http://httpbin.org/anything/get?apiVersion=2');
expect(result2.url).to.equal('http://localhost/anything/get?apiVersion=2');
done();
});
});
Expand All @@ -131,14 +131,14 @@ describe('The Gateway Proxy', () => {
gatewayRequest('/headerSplit/get', (error: any, response: any, body: any) => {
expect(response.statusCode).to.equal(200);
const result = JSON.parse(body);
expect(result.url).to.equal('http://httpbin.org/get');
expect(result.url).to.equal('http://localhost/get');
gatewayRequest.get({
headers: { 'authorization': '2' },
url: '/headerSplit/get'
}, (err: any, res: any, b: any) => {
expect(res.statusCode).to.equal(200);
const result2 = JSON.parse(b);
expect(result2.url).to.equal('http://httpbin.org/anything/get');
expect(result2.url).to.equal('http://localhost/anything/get');
done();
});
});
Expand Down

0 comments on commit 2cf7cb0

Please sign in to comment.