-
Notifications
You must be signed in to change notification settings - Fork 209
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Docker-based tests run via GitHub Actions #233
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,47 @@ | ||
--- | ||
|
||
name: CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
name: CI | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
node-version: [15.x, 14.x, 12.x, 10.x] | ||
|
||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 1 | ||
|
||
- name: Setup Node ${{ matrix.node-version }} | ||
uses: actions/setup-node@v2 | ||
with: | ||
always-auth: false | ||
node-version: ${{ matrix.node-version }} | ||
|
||
- name: Start Solr | ||
run: npm run solr:start | ||
|
||
- name: Run npm install | ||
run: npm install | ||
|
||
- name: Run Tests | ||
run: npm run test | ||
env: | ||
CI: true | ||
|
||
- name: Stop Solr | ||
run: npm run solr:stop |
This file was deleted.
Oops, something went wrong.
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,13 @@ | ||
version: '3' | ||
services: | ||
solr: | ||
image: solr:5.5.5 | ||
ports: | ||
- "8983:8983" | ||
volumes: | ||
- data:/var/solr | ||
command: | ||
- solr-precreate | ||
- testcore | ||
volumes: | ||
data: |
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,130 @@ | ||
const http = require('http'), | ||
https = require('https'), | ||
SolrError = require('./error/solr-error'), | ||
JSONbig = require('json-bigint'); | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. extracted part of solr.js so that it could be reused elsewhere (in my cases, in |
||
/** | ||
* Pick appropriate protocol based on the given `secure` flag | ||
* | ||
* @param {Boolean} secure - | ||
* @return {Object} http or https module | ||
* @api private | ||
*/ | ||
|
||
function pickProtocol(secure){ | ||
return secure ? https : http; | ||
} | ||
|
||
/** | ||
* Pick appropriate JSON serializer/deserializer library based on the given `bigint` flag | ||
* @param {Boolean} bigint - whenever to handle big number correctly or not (the reason for not using JSONbig all the times is it has an important performance cost) | ||
* @return {Object} JSON or JSONbig serializer/deserializer | ||
* @api private | ||
*/ | ||
|
||
function pickJSON(bigint){ | ||
return bigint ? JSONbig : JSON; | ||
}; | ||
|
||
/** | ||
* Handle HTTP JSON response from Solr | ||
* | ||
* @param {Function} callback(err,obj) - a function executed when the Solr server responds or an error occurs | ||
* @param {Error} callback().err | ||
* @param {Object} callback().obj - JSON response sent by the Solr server deserialized | ||
* | ||
* @api private | ||
*/ | ||
|
||
function handleJSONResponse(request, bigint, callback){ | ||
return function onJSONResponse(response){ | ||
var text = ''; | ||
var err = null; | ||
var data = null; | ||
|
||
// This properly handles multi-byte characters | ||
response.setEncoding('utf-8'); | ||
|
||
response.on('data',function(chunk){ | ||
text += chunk; | ||
}); | ||
|
||
response.on('end',function(){ | ||
if(response.statusCode < 200 || response.statusCode > 299){ | ||
err = new SolrError(request,response,text); | ||
if(callback) callback(err,null); | ||
}else{ | ||
try{ | ||
data = pickJSON(bigint).parse(text); | ||
}catch(error){ | ||
err = error; | ||
}finally{ | ||
if(callback) callback(err,data); | ||
} | ||
} | ||
}); | ||
}; | ||
}; | ||
|
||
|
||
/** | ||
* HTTP POST request. Send update commands to the Solr server (commit, add, delete, optimize) | ||
* | ||
* @param {Object} params | ||
* @param {String} params.host - IP address or host address of the Solr server | ||
* @param {Number|String} params.port - port of the Solr server | ||
* @param {String} params.core - name of the Solr core requested | ||
* @param {String} params.authorization - value of the authorization header | ||
* @param {String} params.fullPath - full path of the request | ||
* @param {String} params.json - | ||
* @param {Boolean} params.secure - | ||
* @param {Boolean} params.bigint - | ||
* @param {http.Agent} [params.agent] - | ||
* @param {Function} callback(err,obj) - a function executed when the Solr server responds or an error occurs | ||
* @param {Error} callback().err | ||
* @param {Object} callback().obj - JSON response sent by the Solr server deserialized | ||
* | ||
* @return {http.ClientRequest} | ||
* @api private | ||
*/function postJSON(params,callback){ | ||
var headers = { | ||
'content-type' : 'application/json; charset=utf-8', | ||
'content-length': Buffer.byteLength(params.json), | ||
'accept' : 'application/json; charset=utf-8' | ||
}; | ||
if(params.authorization){ | ||
headers['authorization'] = params.authorization; | ||
} | ||
var options = { | ||
host : params.host, | ||
port : params.port, | ||
method : 'POST', | ||
headers : headers, | ||
path : params.fullPath, | ||
family : params.ipversion | ||
}; | ||
|
||
if(params.agent !== undefined){ | ||
options.agent = params.agent; | ||
} | ||
|
||
var request = pickProtocol(params.secure).request(options); | ||
|
||
request.on('response', handleJSONResponse(request, params.bigint, callback)); | ||
|
||
request.on('error',function onError(err){ | ||
if (callback) callback(err,null); | ||
}); | ||
|
||
request.write(params.json); | ||
request.end(); | ||
|
||
return request; | ||
}; | ||
|
||
module.exports = { | ||
handleJSONResponse, | ||
pickJSON, | ||
pickProtocol, | ||
postJSON | ||
} |
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wanted to get it running on the closest version to what we were running it before, and start upgrading later.