Skip to content

Commit

Permalink
updated README.md and configured integration test to run setup and cl…
Browse files Browse the repository at this point in the history
…eanup logic
  • Loading branch information
sauravcld committed Jan 15, 2021
1 parent 24b493d commit 5218d65
Show file tree
Hide file tree
Showing 7 changed files with 480 additions and 41 deletions.
60 changes: 60 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,66 @@ rice embed-go
export ACTIVE_ENV=PRODUCTION
go run main.go
```
* Run the **Integration Tests**
Running the integration test will require the files present in the [staging](./config-files/staging) folder to be configured as below:
config.staging.json
```
{
"GoogleProjectID": "<your-project-id>",
"SpannerDb": "<any-db-name>",
"QueryLimit": 5000
}
```
spanner.staging.json
```
{
"dynamodb_adapter_table_ddl": "<spanner-instance-name>",
"dynamodb_adapter_config_manager": "<spanner-instance-name>",
"department": "<spanner-instance-name>",
"employee": "<spanner-instance-name>"
}
```
tables.staging.json
```
{
"employee":{
"partitionKey":"emp_id",
"sortKey": "",
"attributeTypes": {
"emp_id": "N",
"first_name":"S",
"last_name":"S",
"address":"S",
"age":"N"
},
"indices": {}
},
"department":{
"partitionKey":"d_id",
"sortKey": "",
"attributeTypes": {
"d_id": "N",
"d_name":"S",
"d_specialization":"S"
},
"indices": {}
}
}
```
The integration tests will also require the **spanner database instance** to be set in the environment variable.
```
export SPANNER_DB_INSTANCE=spanner-instance
```
Execute test
```
go test integrationtest/api_test.go integrationtest/setup.go
```
## Starting Process
* Step 1: DynamoDB-adapter will load the configuration according the Environment Variable *ACTIVE_ENV*
Expand Down
4 changes: 2 additions & 2 deletions config-files/staging/config-staging.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"GoogleProjectID": "Your Google Project ID",
"SpannerDb": "Your Spanner Database Name",
"GoogleProjectID": "cc-dev-sandbox-20200619",
"SpannerDb": "test-db",
"QueryLimit": 5000
}
7 changes: 4 additions & 3 deletions config-files/staging/spanner-staging.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"dynamodb_adapter_table_ddl": "instance-ID of dynamodb_adapter_table_ddl table",
"dynamodb_adapter_config_manager": "instance-ID of dynamodb_adapter_config_manager table",
"tableName": "instance-ID of Table"
"dynamodb_adapter_table_ddl": "test-instance",
"dynamodb_adapter_config_manager": "test-instance",
"department": "test-instance",
"employee": "test-instance"
}
34 changes: 19 additions & 15 deletions config-files/staging/tables-staging.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
{
"tableName":{
"partitionKey":"primary key or Partition key",
"sortKey": "sorting key of dynamoDB adapter",
"employee":{
"partitionKey":"emp_id",
"sortKey": "",
"attributeTypes": {
"ColInt64": "N",
"ColString": "S",
"ColBytes": "B",
"ColBool": "BOOL",
"ColDate": "S",
"ColTimestamp": "S"
"emp_id": "N",
"first_name":"S",
"last_name":"S",
"address":"S",
"age":"N"
},
"indices": {
"indexName1": {
"sortKey": "sort key for indexName1",
"partitionKey": "partition key for indexName1"
}
}
"indices": {}
},
"department":{
"partitionKey":"d_id",
"sortKey": "",
"attributeTypes": {
"d_id": "N",
"d_name":"S",
"d_specialization":"S"
},
"indices": {}
}
}
Loading

0 comments on commit 5218d65

Please sign in to comment.