-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #191 from splitio/development
Development
- Loading branch information
Showing
32 changed files
with
1,368 additions
and
3,752 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
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 |
---|---|---|
@@ -1,6 +1,5 @@ | ||
const { gracefulShutDown } = require('../utils/testWrapper/index'); | ||
|
||
afterAll( async (done) => { | ||
afterAll(async () => { | ||
await gracefulShutDown(); | ||
done() | ||
}) | ||
}) |
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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Setup defaults | ||
MAKE ?= make | ||
DOCKER ?= docker | ||
PLATFORM ?= linux/arm64/v8,linux/amd64 | ||
BUILDER ?= container | ||
|
||
version := $(shell cat package.json | grep '"version": "' | sed 's/ "version": "//' | tr -d '",') | ||
|
||
# Help target borrowed from: https://docs.cloudposse.com/reference/best-practices/make-best-practices/ | ||
## This help screen | ||
help: | ||
@printf "Available targets:\n\n" | ||
@awk '/^[a-zA-Z\-\_0-9%:\\]+/ { \ | ||
helpMessage = match(lastLine, /^## (.*)/); \ | ||
if (helpMessage) { \ | ||
helpCommand = $$1; \ | ||
helpMessage = substr(lastLine, RSTART + 3, RLENGTH); \ | ||
gsub("\\\\", "", helpCommand); \ | ||
gsub(":+$$", "", helpCommand); \ | ||
printf " \x1b[32;01m%-35s\x1b[0m %s\n", helpCommand, helpMessage; \ | ||
} \ | ||
} \ | ||
{ lastLine = $$0 }' $(MAKEFILE_LIST) | sort -u | ||
@printf "\n" | ||
|
||
## Build release-ready docker images with proper tags and output push commands in stdout | ||
images_release_multi_load: # entrypoints | ||
@echo "make sure you have buildx configured 'docker buildx ls', if not 'docker buildx create --name container --driver=docker-container'" | ||
$(DOCKER) buildx build \ | ||
-t splitsoftware/split-evaluator:latest -t splitsoftware/split-evaluator:$(version) \ | ||
--platform $(PLATFORM) \ | ||
--builder $(BUILDER) \ | ||
--load . | ||
@echo "Images created. Make sure everything works ok, and then run the following commands to push them." | ||
@echo "$(DOCKER) push splitsoftware/split-evaluator:$(version)" | ||
@echo "$(DOCKER) push splitsoftware/split-evaluator:latest" | ||
|
||
platform_str = $(if $(PLATFORM),--platform $(PLATFORM),) | ||
builder_str = $(if $(BUILDER),--builder $(BUILDER),) |
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 |
---|---|---|
@@ -1,33 +1,30 @@ | ||
const os = require('os'); | ||
const ip = require('@splitsoftware/splitio/lib/utils/ip'); | ||
const ip = require('@splitsoftware/splitio/cjs/utils/ip'); | ||
const request = require('supertest'); | ||
const app = require('../../app'); | ||
const { expectError } = require('../../utils/testWrapper/index'); | ||
|
||
describe('machine', () => { | ||
// Testing authorization | ||
test('should be 401 if auth is not passed', async (done) => { | ||
test('should be 401 if auth is not passed', async () => { | ||
const response = await request(app) | ||
.get('/admin/machine'); | ||
expectError(response, 401, 'Unauthorized'); | ||
done(); | ||
}); | ||
|
||
test('should be 401 if auth does not match', async (done) => { | ||
test('should be 401 if auth does not match', async () => { | ||
const response = await request(app) | ||
.get('/admin/machine') | ||
.set('Authorization', 'invalid'); | ||
expectError(response, 401, 'Unauthorized'); | ||
done(); | ||
}); | ||
|
||
test('should be 200', async (done) => { | ||
test('should be 200', async () => { | ||
const response = await request(app) | ||
.get('/admin/machine') | ||
.set('Authorization', 'test'); | ||
expect(response.statusCode).toEqual(200); | ||
expect(response.body).toHaveProperty('ip', ip.address()); | ||
expect(response.body).toHaveProperty('name', os.hostname()); | ||
done(); | ||
}); | ||
}); |
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
Oops, something went wrong.