-
Notifications
You must be signed in to change notification settings - Fork 4
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 #85 from d-ylee/testRaceConditions
Test race conditions in bulkblocks API
- Loading branch information
Showing
10 changed files
with
353 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/bash | ||
|
||
# Delete original dbfiles and databases and reinitializing them with the schema | ||
rm -f /tmp/dbs-one.db | ||
sqlite3 /tmp/dbs-one.db < ./static/schema/sqlite-schema.sql | ||
echo sqlite3 /tmp/dbs-one.db sqlite > ./test/dbfile_1 | ||
|
||
# Starting DBS servers | ||
echo Starting dbs-one-writer | ||
./dbs2go -config ./test/config/config_dbs_one_writer2.json & | ||
echo $! >> ./test-pids | ||
|
||
sleep 1 |
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,17 @@ | ||
{ | ||
"base": "/dbs-one-writer", | ||
"port": 8990, | ||
"staticdir": "./static", | ||
"dbfile": "./test/dbfile_1", | ||
"lexicon_file": "./static/lexicon_writer.json", | ||
"api_parameters_file": "./static/parameters.json", | ||
"server_type": "DBSWriter", | ||
"servercrt": "", | ||
"serverkey": "", | ||
"hkey": "", | ||
"updateDNs": 60, | ||
"log_file": "/tmp/dbs2go_writer_1_2.log", | ||
"verbose": 2, | ||
"limiter_rate": "10000-s", | ||
"concurrent_bulkblocks": true | ||
} |
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,52 @@ | ||
package main | ||
|
||
import ( | ||
"net/http" | ||
"net/url" | ||
"testing" | ||
|
||
"github.com/dmwm/dbs2go/dbs" | ||
"github.com/dmwm/dbs2go/web" | ||
) | ||
|
||
func getFileParentsTestTable(t *testing.T) EndpointTestCase { | ||
dbsError := dbs.DBSError{ | ||
Reason: dbs.InvalidParamErr.Error(), | ||
Message: "logical_file_name, block_id or block_name is required for fileparents api", | ||
Code: dbs.ParametersErrorCode, | ||
Function: "dbs.fileparents.FileParents", | ||
} | ||
hrec := createHTTPError("GET", "/dbs/primarydstypes?dataset=fnal") | ||
errorResp := web.ServerError{ | ||
HTTPError: hrec, | ||
DBSError: &dbsError, | ||
Exception: http.StatusBadRequest, | ||
Type: "HTTPError", | ||
Message: dbsError.Error(), | ||
} | ||
return EndpointTestCase{ | ||
description: "Test fileparents", | ||
defaultHandler: web.FileParentsHandler, | ||
defaultEndpoint: "/dbs/fileparents", | ||
testCases: []testCase{ | ||
{ // DBSClientReader_t.test041 | ||
description: "Test fileparents with lfn", | ||
method: "GET", | ||
serverType: "DBSReader", | ||
params: url.Values{ | ||
"logical_file_name": []string{TestData.ParentFiles[0]}, | ||
}, | ||
output: []Response{}, | ||
respCode: http.StatusOK, | ||
}, | ||
{ // DBSClientReader_t.test042 | ||
description: "Test fileparents with no params", | ||
method: "GET", | ||
serverType: "DBSReader", | ||
params: url.Values{}, | ||
output: []Response{errorResp}, | ||
respCode: http.StatusBadRequest, | ||
}, | ||
}, | ||
} | ||
} |
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.