mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2025-02-25 18:55:28 -06:00
[adapter-http] Stargate token auto-gen + Mocking + CVE Fixes (#1149)
* Feature for Stargate auto token generation (http-rest) * Mockito dependency added; mocking tests introduced * Support for String mirror as function in binding pipeline * JSON format change within YAML alignment (scenarios) * Updated Swagger parser * Updated docker-java-core * Issue 1148 - notice to users in scenario header
This commit is contained in:
parent
5611b72631
commit
136ae35a11
3
.github/workflows/build.yml
vendored
3
.github/workflows/build.yml
vendored
@ -42,9 +42,10 @@ jobs:
|
||||
- name: Running tests
|
||||
run: mvn -B test
|
||||
|
||||
# Note: the target/coverage-report is not getting generated, involves pom settings not working as expected.
|
||||
# - name: Collecting reports
|
||||
# run: tar -cvf codecov-report.tar target/coverage-report/**/*
|
||||
|
||||
#
|
||||
# - name: Uploading test coverage
|
||||
# uses: actions/upload-artifact@v3
|
||||
# with:
|
||||
|
@ -5,6 +5,7 @@ description: |
|
||||
This should be identical to the cql variant except for:
|
||||
- There is no instrumentation with the http driver.
|
||||
- There is no async mode with the http driver.
|
||||
- Refer to 'http-rest.md' for more information.
|
||||
|
||||
scenarios:
|
||||
default:
|
||||
@ -13,15 +14,10 @@ scenarios:
|
||||
main: run driver=http tags==block:"main.*" cycles===TEMPLATE(main-cycles,10) threads=auto
|
||||
|
||||
bindings:
|
||||
# To enable an optional weighted set of hosts in place of a load balancer
|
||||
# Examples
|
||||
# single host: restapi_host=host1
|
||||
# multiple hosts: restapi_host=host1,host2,host3
|
||||
# multiple weighted hosts: restapi_host=host1:3,host2:7
|
||||
weighted_hosts: WeightedStrings('<<restapi_host:stargate>>')
|
||||
|
||||
weighted_hosts: ToString(); WeightedStrings('<<restapi_host:stargate>>'); ToString();
|
||||
request_id: ToHashedUUID(); ToString();
|
||||
request_token: ToString(); FirstLines("TEMPLATE(stargate_tokenfile,data/stargate_token.txt)");
|
||||
auto_gen_token: Discard(); StargateToken('http://localhost:8081/v1/auth'); ToString();
|
||||
|
||||
seq_key: Mod(<<keycount:10000000>>); ToString() -> String
|
||||
seq_value: Hash(); Mod(<<valuecount:1000000000>>); ToString() -> String
|
||||
@ -37,20 +33,19 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<restapi_port:8082>><<path_prefix:>>/v2/schemas/keyspaces
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
body: |
|
||||
body: >2
|
||||
{
|
||||
"name": "<<keyspace:baselines>>",
|
||||
"replicas": <<rf:1>>
|
||||
"name": "<<keyspace:baselines>>",
|
||||
"replicas": <<rf:1>>
|
||||
}
|
||||
|
||||
drop-table:
|
||||
method: DELETE
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<restapi_port:8082>><<path_prefix:>>/v2/schemas/keyspaces/<<keyspace:baselines>>/tables/<<table:keyvalue>>
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
ok-status: "[2-4][0-9][0-9]"
|
||||
|
||||
@ -59,59 +54,58 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<restapi_port:8082>><<path_prefix:>>/v2/schemas/keyspaces/<<keyspace:baselines>>/tables
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
body: |
|
||||
body: >2
|
||||
{
|
||||
"name": "<<table:keyvalue>>",
|
||||
"columnDefinitions": [
|
||||
{
|
||||
"name": "key",
|
||||
"typeDefinition": "text"
|
||||
},
|
||||
{
|
||||
"name": "value",
|
||||
"typeDefinition": "text"
|
||||
}
|
||||
],
|
||||
"primaryKey": {
|
||||
"partitionKey": [
|
||||
"key"
|
||||
]
|
||||
"name": "<<table:keyvalue>>",
|
||||
"columnDefinitions": [
|
||||
{
|
||||
"name": "key",
|
||||
"typeDefinition": "text"
|
||||
},
|
||||
"ifNotExists": true
|
||||
{
|
||||
"name": "value",
|
||||
"typeDefinition": "text"
|
||||
}
|
||||
],
|
||||
"primaryKey": {
|
||||
"partitionKey": [
|
||||
"key"
|
||||
]
|
||||
},
|
||||
"ifNotExists": true
|
||||
}
|
||||
|
||||
schema-astra:
|
||||
statements:
|
||||
ops:
|
||||
create-table-astra:
|
||||
method: POST
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<restapi_port:8082>><<path_prefix:>>/v2/schemas/keyspaces/<<keyspace:baselines>>/tables
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
body: |
|
||||
body: >2
|
||||
{
|
||||
"name": "<<table:keyvalue>>",
|
||||
"columnDefinitions": [
|
||||
{
|
||||
"name": "key",
|
||||
"typeDefinition": "text"
|
||||
},
|
||||
{
|
||||
"name": "value",
|
||||
"typeDefinition": "text"
|
||||
}
|
||||
{
|
||||
"name": "key",
|
||||
"typeDefinition": "text"
|
||||
},
|
||||
{
|
||||
"name": "value",
|
||||
"typeDefinition": "text"
|
||||
}
|
||||
],
|
||||
"primaryKey": {
|
||||
"partitionKey": [
|
||||
"key"
|
||||
]
|
||||
"partitionKey": [
|
||||
"key"
|
||||
]
|
||||
},
|
||||
"ifNotExists": true
|
||||
}
|
||||
|
||||
rampup:
|
||||
ops:
|
||||
rampup-insert:
|
||||
@ -119,9 +113,9 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<restapi_port:8082>><<path_prefix:>>/v2/keyspaces/<<keyspace:baselines>>/<<table:keyvalue>>
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
body: |
|
||||
body: >2
|
||||
{
|
||||
"key": "{seq_key}",
|
||||
"value": "{seq_value}"
|
||||
@ -136,7 +130,7 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<restapi_port:8082>><<path_prefix:>>/v2/keyspaces/<<keyspace:baselines>>/<<table:keyvalue>>/{rw_key}
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
ok-status: "[2-4][0-9][0-9]"
|
||||
|
||||
@ -149,10 +143,10 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<restapi_port:8082>><<path_prefix:>>/v2/keyspaces/<<keyspace:baselines>>/<<table:keyvalue>>
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
body: |
|
||||
body: >2
|
||||
{
|
||||
"key": "{rw_key}",
|
||||
"value": "{rw_value}"
|
||||
}
|
||||
}
|
@ -6,6 +6,7 @@ description: |
|
||||
- We need to URLEncode the `data` and `data_write` bindings because newlines can't be sent in REST calls.
|
||||
- There is no instrumentation with the http driver.
|
||||
- There is no async mode with the http driver.
|
||||
- Refer to 'http-rest.md' for more information.
|
||||
|
||||
scenarios:
|
||||
default:
|
||||
@ -14,14 +15,9 @@ scenarios:
|
||||
main: run driver=http tags==block:"main.*" cycles===TEMPLATE(main-cycles,10) threads=auto
|
||||
|
||||
bindings:
|
||||
# To enable an optional weighted set of hosts in place of a load balancer
|
||||
# Examples
|
||||
# single host: restapi_host=host1
|
||||
# multiple hosts: restapi_host=host1,host2,host3
|
||||
# multiple weighted hosts: restapi_host=host1:3,host2:7
|
||||
weighted_hosts: WeightedStrings('<<restapi_host:stargate>>')
|
||||
request_id: ToHashedUUID(); ToString();
|
||||
request_token: Discard(); FirstLines("TEMPLATE(stargate_tokenfile,data/stargate_token.txt)");
|
||||
auto_gen_token: Discard(); StargateToken('http://localhost:8081/v1/auth'); ToString();
|
||||
|
||||
# for ramp-up and verify
|
||||
part_layout: Div(<<partsize:1000000>>); ToString() -> String
|
||||
@ -46,9 +42,9 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<restapi_port:8082>><<path_prefix:>>/v2/schemas/keyspaces
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
body: |
|
||||
body: >2
|
||||
{
|
||||
"name": "<<keyspace:baselines>>",
|
||||
"replicas": <<rf:1>>
|
||||
@ -59,7 +55,7 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<restapi_port:8082>><<path_prefix:>>/v2/schemas/keyspaces/<<keyspace:baselines>>/tables/<<table:tabular>>
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
ok-status: "[2-4][0-9][0-9]"
|
||||
|
||||
@ -68,9 +64,9 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<restapi_port:8082>><<path_prefix:>>/v2/schemas/keyspaces/<<keyspace:baselines>>/tables
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
body: |
|
||||
body: >2
|
||||
{
|
||||
"name": "<<table:tabular>>",
|
||||
"columnDefinitions": [
|
||||
@ -105,9 +101,9 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<restapi_port:8082>><<path_prefix:>>/v2/keyspaces/<<keyspace:baselines>>/<<table:tabular>>
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
body: |
|
||||
body: >2
|
||||
{
|
||||
"part": "{part_layout}",
|
||||
"clust": "{clust_layout}",
|
||||
@ -123,7 +119,7 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<restapi_port:8082>><<path_prefix:>>/v2/keyspaces/<<keyspace:baselines>>/<<table:tabular>>/{part_read}&page-size={limit}
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
|
||||
main-write:
|
||||
@ -135,9 +131,9 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<restapi_port:8082>><<path_prefix:>>/v2/keyspaces/<<keyspace:baselines>>/<<table:tabular>>
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
body: |
|
||||
body: >2
|
||||
{
|
||||
"part": "{part_write}",
|
||||
"clust": "{clust_write}",
|
||||
|
@ -1,6 +1,9 @@
|
||||
min_version: "5.17.1"
|
||||
|
||||
description: |
|
||||
NOTE: THIS VERSION IS NOT FUNCTIONING FULLY AND HAS AN OPEN TICKET TO INVESTIGATE:
|
||||
See here: https://github.com/nosqlbench/nosqlbench/issues/1148
|
||||
|
||||
This workload emulates a time-series data model and access patterns.
|
||||
This should be identical to the cql variant except for:
|
||||
- We can't specify the write timestamp to make the write idempotent like we can with cql.
|
||||
@ -9,6 +12,7 @@ description: |
|
||||
- Schema creation is cql of the lack of being able to define compaction strategy in the REST API.
|
||||
- There is no instrumentation with the http driver.
|
||||
- There is no async mode with the http driver.
|
||||
- Refer to 'http-rest.md' for more information.
|
||||
|
||||
scenarios:
|
||||
default:
|
||||
@ -17,16 +21,9 @@ scenarios:
|
||||
main: run driver=http tags==block:"main.*" cycles===TEMPLATE(main-cycles,10) threads=auto
|
||||
|
||||
bindings:
|
||||
# To enable an optional weighted set of hosts in place of a load balancer
|
||||
# Examples
|
||||
# single host: restapi_host=host1
|
||||
# multiple hosts: restapi_host=host1,host2,host3
|
||||
# multiple weighted hosts: restapi_host=host1:3,host2:7
|
||||
weighted_hosts: WeightedStrings('<<restapi_host:stargate>>')
|
||||
|
||||
# http request id
|
||||
request_id: ToHashedUUID(); ToString();
|
||||
request_token: Discard(); FirstLines("TEMPLATE(stargate_tokenfile,data/stargate_token.txt)");
|
||||
auto_gen_token: Discard(); StargateToken('http://localhost:8081/v1/auth'); ToString();
|
||||
|
||||
machine_id: Mod(<<sources:10000>>); ToHashedUUID() -> java.util.UUID
|
||||
sensor_name: HashedLineToString('data/variable_words.txt');
|
||||
@ -36,89 +33,6 @@ bindings:
|
||||
data: HashedFileExtractToString('data/lorem_ipsum_full.txt',800,1200); URLEncode();
|
||||
|
||||
blocks:
|
||||
schema:
|
||||
ops:
|
||||
create-keyspace:
|
||||
method: POST
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<restapi_port:8082>><<path_prefix:>>/v2/schemas/keyspaces
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
Content-Type: "application/json"
|
||||
body: |
|
||||
{
|
||||
"name": "<<keyspace:baselines>>",
|
||||
"replicas": <<rf:1>>
|
||||
}
|
||||
|
||||
drop-table:
|
||||
method: DELETE
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<restapi_port:8082>><<path_prefix:>>/v2/schemas/keyspaces/<<keyspace:baselines>>/tables/<<table:iot>>
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
Content-Type: "application/json"
|
||||
ok-status: "[2-4][0-9][0-9]"
|
||||
|
||||
create-table:
|
||||
method: POST
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<restapi_port:8082>><<path_prefix:>>/v2/schemas/keyspaces/<<keyspace:baselines>>/tables
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
Content-Type: "application/json"
|
||||
body: |
|
||||
{
|
||||
"name": "<<table:iot>>",
|
||||
"columnDefinitions": |
|
||||
[
|
||||
{
|
||||
"name": "machine_id",
|
||||
"typeDefinition": "uuid"
|
||||
},
|
||||
{
|
||||
"name": "sensor_name",
|
||||
"typeDefinition": "text"
|
||||
},
|
||||
{
|
||||
"name": "time",
|
||||
"typeDefinition": "timestamp"
|
||||
},
|
||||
{
|
||||
"name": "sensor_value",
|
||||
"typeDefinition": "double"
|
||||
},
|
||||
{
|
||||
"name": "station_id",
|
||||
"typeDefinition": "uuid"
|
||||
},
|
||||
{
|
||||
"name": "data",
|
||||
"typeDefinition": "text"
|
||||
}
|
||||
],
|
||||
"primaryKey": |
|
||||
{
|
||||
"partitionKey": [
|
||||
"machine_id",
|
||||
"sensor_name"
|
||||
],
|
||||
"clusteringKey": [
|
||||
"time"
|
||||
]
|
||||
},
|
||||
"tableOptions": |
|
||||
{
|
||||
"clusteringExpression": |
|
||||
[
|
||||
{
|
||||
"column": "time",
|
||||
"order": "DESC"
|
||||
}
|
||||
]
|
||||
},
|
||||
"ifNotExists": true
|
||||
}
|
||||
rampup:
|
||||
ops:
|
||||
rampup-insert:
|
||||
@ -126,9 +40,9 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<restapi_port:8082>><<path_prefix:>>/v2/keyspaces/<<keyspace:baselines>>/<<table:iot>>
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
body: |
|
||||
body: >2
|
||||
{
|
||||
"machine_id": "{machine_id}",
|
||||
"sensor_name": "{sensor_name}",
|
||||
@ -137,6 +51,92 @@ blocks:
|
||||
"station_id": "{station_id}",
|
||||
"data": "{data}"
|
||||
}
|
||||
schema:
|
||||
ops:
|
||||
create-keyspace:
|
||||
method: POST
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<restapi_port:8082>><<path_prefix:>>/v2/schemas/keyspaces
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
body: >2
|
||||
{
|
||||
"name": "<<keyspace:baselines>>",
|
||||
"replicas": <<rf:1>>
|
||||
}
|
||||
|
||||
drop-table:
|
||||
method: DELETE
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<restapi_port:8082>><<path_prefix:>>/v2/schemas/keyspaces/<<keyspace:baselines>>/tables/<<table:iot>>
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
ok-status: "[2-4][0-9][0-9]"
|
||||
|
||||
create-table:
|
||||
method: POST
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<restapi_port:8082>><<path_prefix:>>/v2/schemas/keyspaces/<<keyspace:baselines>>/tables
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
body: >2
|
||||
{
|
||||
"name": "<<table:iot>>",
|
||||
"columnDefinitions": |-
|
||||
[
|
||||
{
|
||||
"name": "machine_id",
|
||||
"typeDefinition": "uuid"
|
||||
},
|
||||
{
|
||||
"name": "sensor_name",
|
||||
"typeDefinition": "text"
|
||||
},
|
||||
{
|
||||
"name": "time",
|
||||
"typeDefinition": "timestamp"
|
||||
},
|
||||
{
|
||||
"name": "sensor_value",
|
||||
"typeDefinition": "double"
|
||||
},
|
||||
{
|
||||
"name": "station_id",
|
||||
"typeDefinition": "uuid"
|
||||
},
|
||||
{
|
||||
"name": "data",
|
||||
"typeDefinition": "text"
|
||||
}
|
||||
],
|
||||
"primaryKey": |-
|
||||
{
|
||||
"partitionKey": |-
|
||||
[
|
||||
"machine_id",
|
||||
"sensor_name"
|
||||
],
|
||||
"clusteringKey": |-
|
||||
[
|
||||
"time"
|
||||
]
|
||||
},
|
||||
"tableOptions": |-
|
||||
{
|
||||
"clusteringExpression": |-
|
||||
[
|
||||
{
|
||||
"column": "time",
|
||||
"order": "DESC"
|
||||
}
|
||||
]
|
||||
},
|
||||
"ifNotExists": true
|
||||
}
|
||||
|
||||
main-read:
|
||||
params:
|
||||
ratio: <<read_ratio:1>>
|
||||
@ -146,7 +146,7 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<restapi_port:8082>><<path_prefix:>>/v2/keyspaces/<<keyspace:baselines>>/<<table:iot>>?where=URLENCODE[[{"machine_id":{"$eq":"{machine_id}"},"sensor_name":{"$eq":"{sensor_name}"}}]]&page-size=<<limit:10>>
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
|
||||
main-write:
|
||||
@ -158,9 +158,9 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<restapi_port:8082>><<path_prefix:>>/v2/keyspaces/<<keyspace:baselines>>/<<table:iot>>
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
body: |
|
||||
body: >2
|
||||
{
|
||||
"machine_id": "{machine_id}",
|
||||
"sensor_name": "{sensor_name}",
|
||||
|
@ -0,0 +1,30 @@
|
||||
# Baselines/http-rest-* Usage Guide
|
||||
|
||||
Identifies some key settings, as well as tips & tricks for use with the `http-rest-*` baseline activities.
|
||||
|
||||
## Hosts
|
||||
### weighted_hosts
|
||||
Enabling an optional weighted set of hosts in place of a load balancer.
|
||||
|
||||
### Examples
|
||||
* single host: restapi_host=host1
|
||||
* multiple hosts: restapi_host=host1,host2,host3
|
||||
* multiple weighted hosts: restapi_host=host1:3,host2:7
|
||||
|
||||
## Tokens
|
||||
Currently supporting Stargate, with plans to make more generic where REST tokens are required. Provide your own auth token via param `auth_token` in which case, the following 'auto_gen_token'
|
||||
can be commented out. Otherwise, the default automatic token generation is used.
|
||||
|
||||
### auto_gen_token
|
||||
Use the `StargateToken('url')` unary string binding function, which auto-generates, caches, and returns a token with automatic refresh upon expiry.
|
||||
|
||||
### Example
|
||||
* auto_gen_token: Discard(); StargateToken('http://localhost:8081/v1/auth');
|
||||
|
||||
Here `Discard()` will ignore the long input value received (by default for the binding), then the StargateToken function automates a check for a cached Stargate token.
|
||||
If not already discovered, a request to the local running Stargate service will be invoked. Each subsequent cycles utilizes the cached value until a timeout occurs or the workload is restarted.
|
||||
|
||||
Regardless of the option used, both will be considered to determine the value for the following:
|
||||
```yaml
|
||||
X-Cassandra-Token: "<<{auth_token}:{auto_gen_token}>>"
|
||||
```
|
@ -22,7 +22,7 @@ bindings:
|
||||
weighted_hosts: WeightedStrings('<<docsapi_host:stargate>>')
|
||||
# http request id
|
||||
request_id: ToHashedUUID(); ToString();
|
||||
request_token: Discard(); FirstLines("TEMPLATE(stargate_tokenfile,data/stargate_token.txt)");
|
||||
auto_gen_token: Discard(); StargateToken('http://localhost:8081/v1/auth'); ToString();
|
||||
|
||||
seq_key: Mod(<<docscount:10000000>>); ToString() -> String
|
||||
random_key: Uniform(0,<<docscount:10000000>>); ToString() -> String
|
||||
@ -46,9 +46,9 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/schemas/namespaces
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
body: |
|
||||
body: >2
|
||||
{
|
||||
"name": "<<namespace:docs_crud_basic>>",
|
||||
"replicas": <<rf:1>>
|
||||
@ -60,7 +60,7 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_crud_basic>>/collections/<<collection:docs_collection>>
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
ok-status: "[2-4][0-9][0-9]"
|
||||
|
||||
create-docs-collection:
|
||||
@ -68,9 +68,9 @@ blocks:
|
||||
method: POST
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
body: |
|
||||
body: >2
|
||||
{
|
||||
"name": "<<collection:docs_collection>>"
|
||||
}
|
||||
@ -82,9 +82,9 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_crud_basic>>/collections/<<collection:docs_collection>>/{seq_key}
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
body: |
|
||||
body: >2
|
||||
{
|
||||
"user_id": "{user_id}",
|
||||
"created_on": {created_on},
|
||||
@ -116,7 +116,7 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_crud_basic>>/collections/<<collection:docs_collection>>/{random_key}
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
ok-status: "[2-4][0-9][0-9]"
|
||||
|
||||
update:
|
||||
@ -126,9 +126,9 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_crud_basic>>/collections/<<collection:docs_collection>>/{random_key}
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
body: |
|
||||
body: >2
|
||||
{
|
||||
"user_id": "{user_id}",
|
||||
"created_on": {created_on},
|
||||
@ -159,5 +159,5 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_crud_basic>>/collections/<<collection:docs_collection>>/{seq_key}
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
ok-status: "[2-4][0-9][0-9]"
|
@ -23,7 +23,7 @@ bindings:
|
||||
weighted_hosts: WeightedStrings('<<docsapi_host:stargate>>')
|
||||
# http request id
|
||||
request_id: ToHashedUUID(); ToString();
|
||||
request_token: Discard(); FirstLines("TEMPLATE(stargate_tokenfile,data/stargate_token.txt)");
|
||||
auto_gen_token: Discard(); StargateToken('http://localhost:8081/v1/auth'); ToString();
|
||||
|
||||
seq_key: Mod(<<docscount:10000000>>); ToString() -> String
|
||||
random_key: Uniform(0,<<docscount:10000000>>); ToString() -> String
|
||||
@ -37,9 +37,9 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/schemas/namespaces
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
body: |
|
||||
body: >2
|
||||
{
|
||||
"name": "<<namespace:docs_crud_dataset>>",
|
||||
"replicas": <<rf:1>>
|
||||
@ -51,7 +51,7 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_crud_dataset>>/collections/<<collection:docs_collection>>
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
ok-status: "[2-4][0-9][0-9]"
|
||||
|
||||
create-docs-collection:
|
||||
@ -59,9 +59,9 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_crud_dataset>>/collections
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
body: |
|
||||
body: >2
|
||||
{
|
||||
"name": "<<collection:docs_collection>>"
|
||||
}
|
||||
@ -72,7 +72,7 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_crud_dataset>>/collections/<<collection:docs_collection>>/{seq_key}
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
body: "{document_json}"
|
||||
|
||||
@ -81,7 +81,7 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_crud_dataset>>/collections/<<collection:docs_collection>>/{random_key}
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
ok-status: "[2-4][0-9][0-9]"
|
||||
|
||||
# TODO - what is the purpose of this? does it overwrite? is there a way to make sure it is actually overwriting existing documents?
|
||||
@ -90,7 +90,7 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_crud_dataset>>/collections/<<collection:docs_collection>>/{random_key}
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
body: "{document_json}"
|
||||
|
||||
@ -99,5 +99,5 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_crud_dataset>>/collections/<<collection:docs_collection>>/{seq_key}
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
ok-status: "[2-4][0-9][0-9]"
|
||||
|
@ -24,6 +24,8 @@ bindings:
|
||||
# http request id
|
||||
request_id: ToHashedUUID(); ToString();
|
||||
|
||||
auto_gen_token: Discard(); StargateToken('http://localhost:8081/v1/auth'); ToString();
|
||||
|
||||
seq_key: Mod(<<keycount:10000000>>); ToString() -> String
|
||||
seq_value: Hash(); Mod(<<valuecount:10000000>>); ToString() -> String
|
||||
rw_key: <<keydist:Uniform(0,<<keycount:10000000>>)->int>>; ToString() -> String
|
||||
@ -37,9 +39,9 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/schemas/namespaces
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "<<auth_token:my_auth_token>>"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
body: |
|
||||
body: >2
|
||||
{
|
||||
"name": "<<namespace:docs_keyvalue>>",
|
||||
"replicas": <<rf:1>>
|
||||
@ -51,7 +53,7 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_keyvalue>>/collections/<<collection:docs_collection>>
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "<<auth_token:my_auth_token>>"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
ok-status: "[2-4][0-9][0-9]"
|
||||
|
||||
create-docs-collection:
|
||||
@ -59,9 +61,9 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_keyvalue>>/collections
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "<<auth_token:my_auth_token>>"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
body: |
|
||||
body: >2
|
||||
{
|
||||
"name": "<<collection:docs_collection>>"
|
||||
}
|
||||
@ -73,9 +75,9 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_keyvalue>>/collections/<<collection:docs_collection>>/{seq_key}
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "<<auth_token:my_auth_token>>"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
body: |
|
||||
body: >2
|
||||
{
|
||||
"{seq_key}":"{seq_value}"
|
||||
}
|
||||
@ -89,7 +91,7 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_keyvalue>>/collections/<<collection:docs_collection>>/{rw_key}
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "<<auth_token:my_auth_token>>"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
ok-status: "[2-4][0-9][0-9]"
|
||||
|
||||
main-write:
|
||||
@ -97,9 +99,9 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_keyvalue>>/collections/<<collection:docs_collection>>/{rw_key}
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "<<auth_token:my_auth_token>>"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
body: |
|
||||
body: >2
|
||||
{
|
||||
"{rw_key}":"{rw_value}"
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ bindings:
|
||||
match3: Identity(); CoinFunc(<<match-ratio>>, FixedValue("true"), FixedValue("false"))
|
||||
|
||||
additional_fields: ListSizedStepped(<<docpadding:0>>,Template("\"{}\":{}",Identity(),Identity())); ToString(); ReplaceAll('\[\"', ',\"'); ReplaceAll('\[', ''); ReplaceAll('\]', '') -> String
|
||||
request_token: Discard(); FirstLines("TEMPLATE(stargate_tokenfile,data/stargate_token.txt)");
|
||||
auto_gen_token: Discard(); StargateToken('http://localhost:8081/v1/auth'); ToString();
|
||||
|
||||
blocks:
|
||||
schema:
|
||||
@ -67,9 +67,9 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/schemas/namespaces
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
body: |
|
||||
body: >2
|
||||
{
|
||||
"name": "<<namespace:docs_search_advanced>>",
|
||||
"replicas": <<rf:1>>
|
||||
@ -81,7 +81,7 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_advanced>>/collections/<<collection:docs_collection>>
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
ok-status: "[2-4][0-9][0-9]"
|
||||
|
||||
create-docs-collection:
|
||||
@ -89,7 +89,7 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_advanced>>/collections
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
body: |
|
||||
{
|
||||
@ -103,9 +103,9 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_advanced>>/collections/<<collection:docs_collection>>/{seq_key}
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
body: |
|
||||
body: >2
|
||||
{
|
||||
"user_id": "{user_id}",
|
||||
"created_on": {created_on},
|
||||
@ -140,7 +140,7 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_advanced>>/collections/<<collection:docs_collection>>?where=URLENCODE[[{"match1":{"$in":[0]}}]]&page-size=<<page-size,3>>&fields=<<fields,%5b%5d>>
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
|
||||
# where={"match2":{"$nin":["false"]}}
|
||||
@ -149,7 +149,7 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_advanced>>/collections/<<collection:docs_collection>>?where=URLENCODE[[{"match2":{"$nin":["false"]}}]]&page-size=<<page-size,3>>&fields=<<fields,%5b%5d>>
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
|
||||
# where={"match2":{"$eq":"true"},"match3":{"$ne": false}}
|
||||
@ -158,7 +158,7 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_advanced>>/collections/<<collection:docs_collection>>?where=URLENCODE[[{"match2":{"$eq":"true"},"match3":{"$ne":false}}]]&page-size=<<page-size,3>>&fields=<<fields,%5b%5d>>
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
|
||||
rampup-get-mem-or:
|
||||
@ -167,7 +167,7 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_advanced>>/collections/<<collection:docs_collection>>?where=URLENCODE[[{"$or":[{"match1":{"$lt":1}},{"match3":{"$exists":true}}]}]]&page-size=<<page-size,3>>&fields=<<fields,%5b%5d>>
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
|
||||
# where={"$and":[{"match1":{"$eq":0}},{"$or":[{"match2":{"$eq":"true"}},{"match3":{"$eq":false}}]}]}
|
||||
@ -176,7 +176,7 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_advanced>>/collections/<<collection:docs_collection>>?where=URLENCODE[[{"$and":[{"match1":{"$eq":0}},{"$or":[{"match2":{"$eq":"true"}},{"match3":{"$eq":false}}]}]}]]&page-size=<<page-size,3>>&fields=<<fields,%5b%5d>>
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
|
||||
rampup-get-complex2:
|
||||
@ -185,7 +185,7 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_advanced>>/collections/<<collection:docs_collection>>?where=URLENCODE[[{"$and":[{"$or":[{"match1":{"$lte":0}},{"match2":{"$eq":"false"}}]},{"$or":[{"match2":{"$eq":"false"}},{"match3":{"$eq":true}}]}]}]]&page-size=<<page-size,3>>&fields=<<fields,%5b%5d>>
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
|
||||
# where={"$or":[{"$and":[{"match1":{"$lte":0}},{"match2":{"$eq":"true"}}]},{"$and":[{"match2":{"$eq":"false"}},{"match3":{"$eq":true}}]}]}
|
||||
@ -194,7 +194,7 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_advanced>>/collections/<<collection:docs_collection>>?where=URLENCODE[[{"$or":[{"$and":[{"match1":{"$lte":0}},{"match2":{"$eq":"true"}}]},{"$and":[{"match2":{"$eq":"false"}},{"match3":{"$eq":true}}]}]}]]&page-size=<<page-size,3>>&fields=<<fields,%5b%5d>>
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
|
||||
main:
|
||||
@ -205,7 +205,7 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_advanced>>/collections/<<collection:docs_collection>>?where=URLENCODE[[{"match1":{"$in":[0]}}]]&page-size=<<page-size,3>>&fields=<<fields,%5b%5d>>
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
|
||||
# where={"match2":{"$nin":["false"]}}
|
||||
@ -214,7 +214,7 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_advanced>>/collections/<<collection:docs_collection>>?where=URLENCODE[[{"match2":{"$nin":["false"]}}]]&page-size=<<page-size,3>>&fields=<<fields,%5b%5d>>
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
|
||||
# where={"match2":{"$eq":"true"},"match3":{"$ne": false}}
|
||||
@ -223,7 +223,7 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_advanced>>/collections/<<collection:docs_collection>>?where=URLENCODE[[{"match2":{"$eq":"true"},"match3":{"$ne":false}}]]&page-size=<<page-size,3>>&fields=<<fields,%5b%5d>>
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
|
||||
# where={"$or":[{"match1":{"$lt":1}},{"match3":{"$exists":true}}]}
|
||||
@ -232,7 +232,7 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_advanced>>/collections/<<collection:docs_collection>>?where=URLENCODE[[{"$or":[{"match1":{"$lt":1}},{"match3":{"$exists":true}}]}]]&page-size=<<page-size,3>>&fields=<<fields,%5b%5d>>
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
|
||||
# where={"$and":[{"match1":{"$eq":0}},{"$or":[{"match2":{"$eq":"true"}},{"match3":{"$eq":false}}]}]}
|
||||
@ -241,7 +241,7 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_advanced>>/collections/<<collection:docs_collection>>?where=URLENCODE[[{"$and":[{"match1":{"$eq":0}},{"$or":[{"match2":{"$eq":"true"}},{"match3":{"$eq":false}}]}]}]]&page-size=<<page-size,3>>&fields=<<fields,%5b%5d>>
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
|
||||
# where={"$and":[{"$or":[{"match1":{"$lte":0}},{"match2":{"$eq":"false"}}]},{"$or":[{"match2":{"$eq":"false"}},{"match3":{"$eq":true}}]}]}
|
||||
@ -250,7 +250,7 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_advanced>>/collections/<<collection:docs_collection>>?where=URLENCODE[[{"$and":[{"$or":[{"match1":{"$lte":0}},{"match2":{"$eq":"false"}}]},{"$or":[{"match2":{"$eq":"false"}},{"match3":{"$eq":true}}]}]}]]&page-size=<<page-size,3>>&fields=<<fields,%5b%5d>>
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
|
||||
# where={"$or":[{"$and":[{"match1":{"$lte":0}},{"match2":{"$eq":"true"}}]},{"$and":[{"match2":{"$eq":"false"}},{"match3":{"$eq":true}}]}]}
|
||||
@ -259,5 +259,5 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_advanced>>/collections/<<collection:docs_collection>>?where=URLENCODE[[{"$or":[{"$and":[{"match1":{"$lte":0}},{"match2":{"$eq":"true"}}]},{"$and":[{"match2":{"$eq":"false"}},{"match3":{"$eq":true}}]}]}]]&page-size=<<page-size,3>>&fields=<<fields,%5b%5d>>
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
|
@ -28,7 +28,7 @@ bindings:
|
||||
weighted_hosts: WeightedStrings('<<docsapi_host:stargate>>')
|
||||
# http request id
|
||||
request_id: ToHashedUUID(); ToString();
|
||||
request_token: Discard(); FirstLines("TEMPLATE(stargate_tokenfile,data/stargate_token.txt)");
|
||||
auto_gen_token: Discard(); StargateToken('http://localhost:8081/v1/auth'); ToString();
|
||||
|
||||
seq_key: Mod(<<docscount:10000000>>); ToString() -> String
|
||||
random_key: Uniform(0,<<docscount:10000000>>); ToString() -> String
|
||||
@ -55,9 +55,9 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/schemas/namespaces
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
body: |
|
||||
body: >2
|
||||
{
|
||||
"name": "<<namespace:docs_search_basic>>",
|
||||
"replicas": <<rf:1>>
|
||||
@ -69,7 +69,7 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_basic>>/collections/<<collection:docs_collection>>
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
ok-status: "[2-4][0-9][0-9]"
|
||||
|
||||
create-docs-collection:
|
||||
@ -77,9 +77,9 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_basic>>/collections
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
body: |
|
||||
body: >2
|
||||
{
|
||||
"name": "<<collection:docs_collection>>"
|
||||
}
|
||||
@ -91,9 +91,9 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_basic>>/collections/<<collection:docs_collection>>/{seq_key}
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
body: |
|
||||
body: >2
|
||||
{
|
||||
"user_id": "{user_id}",
|
||||
"created_on": {created_on},
|
||||
@ -127,7 +127,7 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_basic>>/collections/<<collection:docs_collection>>?where=URLENCODE[[{"match3":{"$eq":true}}]]&page-size=<<page-size,3>>&fields=<<fields,%5b%5d>>
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
|
||||
# where={"match1":{"$lt":1}}
|
||||
@ -136,7 +136,7 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_basic>>/collections/<<collection:docs_collection>>?where=URLENCODE[[{"match1":{"$lt":1}}]]&page-size=<<page-size,3>>&fields=<<fields,%5b%5d>>
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
|
||||
# where={"match1":{"$lt":1},"match2":{"$eq":"true"}}
|
||||
@ -145,7 +145,7 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_basic>>/collections/<<collection:docs_collection>>?where=URLENCODE[[{"match1":{"$lt":1},"match2":{"$eq":"true"}}]]&page-size=<<page-size,3>>&fields=<<fields,%5b%5d>>
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
|
||||
# where={"$or":[{"match1":{"$lt":1}},{"match3":{"$eq":true}}]}
|
||||
@ -154,7 +154,7 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_basic>>/collections/<<collection:docs_collection>>?where=URLENCODE[[{"$or":[{"match1":{"$lt":1}},{"match3":{"$eq":true}}]}]]&page-size=<<page-size,3>>&fields=<<fields,%5b%5d>>
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
|
||||
# where={"$or":[{"match1":{"$lt":1}},{"match2":{"$eq":"notamatch"}}]}
|
||||
@ -163,7 +163,7 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_basic>>/collections/<<collection:docs_collection>>?where=URLENCODE[[{"$or":[{"match1":{"$lt":1}},{"match2":{"$eq":"notamatch"}}]}]]&page-size=<<page-size,3>>&fields=<<fields,%5b%5d>>
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
|
||||
# where={"match3":{"$eq":true}}
|
||||
@ -174,7 +174,7 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_basic>>/collections/<<collection:docs_collection>>?where=URLENCODE[[{"match3":{"$eq":true}}]]&page-size=<<page-size,3>>&fields=<<fields,%5b%5d>>
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
|
||||
# where={"match1":{"$lt":1}}
|
||||
@ -183,7 +183,7 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_basic>>/collections/<<collection:docs_collection>>?where=URLENCODE[[{"match1":{"$lt":1}}]]&page-size=<<page-size,3>>&fields=<<fields,%5b%5d>>
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
|
||||
# where={"match1":{"$lt":1},"match2":{"$eq":"true"}}
|
||||
@ -192,7 +192,7 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_basic>>/collections/<<collection:docs_collection>>?where=URLENCODE[[{"match1":{"$lt":1},"match2":{"$eq":"true"}}]]&page-size=<<page-size,3>>&fields=<<fields,%5b%5d>>
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
|
||||
# where={"$or":[{"match1":{"$lt":1}},{"match3":{"$eq":true}}]}
|
||||
@ -201,7 +201,7 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_basic>>/collections/<<collection:docs_collection>>?where=URLENCODE[[{"$or":[{"match1":{"$lt":1}},{"match3":{"$eq":true}}]}]]&page-size=<<page-size,3>>&fields=<<fields,%5b%5d>>
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
|
||||
# where={"$or":[{"match1":{"$lt":1}},{"match2":{"$eq":"notamatch"}}]}
|
||||
@ -210,5 +210,5 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<docsapi_port:8180>><<path_prefix:>>/v2/namespaces/<<namespace:docs_search_basic>>/collections/<<collection:docs_collection>>?where=URLENCODE[[{"$or":[{"match1":{"$lt":1}},{"match2":{"$eq":"notamatch"}}]}]]&page-size=<<page-size,3>>&fields=<<fields,%5b%5d>>
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
|
@ -22,7 +22,7 @@ bindings:
|
||||
weighted_hosts: WeightedStrings('<<graphql_host:stargate>>')
|
||||
# http request id
|
||||
request_id: ToHashedUUID(); ToString();
|
||||
request_token: Discard(); FirstLines("TEMPLATE(stargate_tokenfile,data/stargate_token.txt)");
|
||||
auto_gen_token: Discard(); StargateToken('http://localhost:8081/v1/auth'); ToString();
|
||||
|
||||
seq_key: Mod(<<keycount:10000000>>); ToString() -> String
|
||||
seq_value: Hash(); Mod(<<valuecount:1000000000>>); ToString() -> String
|
||||
@ -37,17 +37,17 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql-schema
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
body: |
|
||||
{"query":"mutation {\n createKeyspace(name:\"<<keyspace:gqlcf_keyvalue>>\", replicas: <<rf:1>>, ifNotExists: true)\n}"}
|
||||
body: >2
|
||||
{"quersy":"mutation {\n createKeyspace(name:\"<<keyspace:gqlcf_keyvalue>>\", replicas: <<rf:1>>, ifNotExists: true)\n}"}
|
||||
|
||||
create-table:
|
||||
method: POST
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql-schema
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
body: |
|
||||
{"query":"mutation {\n createTable(\n keyspaceName: \"<<keyspace:gqlcf_keyvalue>>\"\n tableName: \"<<table:keyvalue>>\"\n partitionKeys: [{ name: \"key\", type: { basic: TEXT } }]\n values: [{ name: \"value\", type: { basic: TEXT } }]\n ifNotExists: true\n )\n}"}
|
||||
@ -59,7 +59,7 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql/<<keyspace:gqlcf_keyvalue>>
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
body: |
|
||||
{"query":"mutation {\n insert<<table:keyvalue>>( value: {key: \"{seq_key}\", value: \"{seq_value}\",}) {value {key, value}}}"}
|
||||
@ -73,7 +73,7 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql/<<keyspace:gqlcf_keyvalue>>
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
body: |
|
||||
{"query":"{<<table:keyvalue>>(value: {key: \"{rw_key}\"}) {values {key, value}}}"}
|
||||
@ -87,7 +87,7 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql/<<keyspace:gqlcf_keyvalue>>
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
body: |
|
||||
{"query":"mutation {\n insert<<table:keyvalue>>( value: {key: \"{rw_key}\", value: \"{rw_value}\",}) {value {key, value}}}"}
|
||||
|
@ -23,7 +23,7 @@ bindings:
|
||||
weighted_hosts: WeightedStrings('<<graphql_host:stargate>>')
|
||||
# http request id
|
||||
request_id: ToHashedUUID(); ToString();
|
||||
request_token: Discard(); FirstLines("TEMPLATE(stargate_tokenfile,data/stargate_token.txt)");
|
||||
auto_gen_token: Discard(); StargateToken('http://localhost:8081/v1/auth'); ToString();
|
||||
# for ramp-up and verify
|
||||
part_layout: Div(<<partsize:1000000>>); ToString() -> String
|
||||
clust_layout: Mod(<<partsize:1000000>>); ToString() -> String
|
||||
@ -47,7 +47,7 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql-schema
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
body: |
|
||||
{"query":"mutation {\n createKeyspace(name:\"<<keyspace:gqlcf_tabular>>\", replicas: <<rf:1>>, ifNotExists: true)\n}"}
|
||||
@ -57,7 +57,7 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql-schema
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
body: |
|
||||
{"query":"mutation {\n createTable(\n keyspaceName: \"<<keyspace:gqlcf_tabular>>\"\n tableName: \"<<table:tabular>>\"\n partitionKeys: [{ name: \"part\", type: { basic: TEXT } }]\n clusteringKeys: [{ name: \"clust\", type: { basic: TEXT } }]\n values: [{ name: \"data\", type: { basic: TEXT } }]\n ifNotExists: true\n )\n}\n"}
|
||||
@ -69,7 +69,7 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql/<<keyspace:gqlcf_tabular>>
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
body: |
|
||||
{"query":"mutation {\n insert<<table:tabular>>( value: {part: \"{part_layout}\", clust: \"{clust_layout}\", data: \"{data}\"}) {value {part, clust, data}}}"}
|
||||
@ -83,9 +83,9 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql/<<keyspace:gqlcf_tabular>>
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
body: |
|
||||
body: >2
|
||||
{"query":"{<<table:tabular>>(value: {part: \"{part_read}\"}, options: { pageSize: <<limit:10>> }) {values {part, clust, data}}}"}
|
||||
|
||||
main-write:
|
||||
@ -97,7 +97,7 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql/<<keyspace:gqlcf_tabular>>
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
body: |
|
||||
body: >2
|
||||
{"query":"mutation {\n insert<<table:tabular>>( value: {part: \"{part_write}\", clust: \"{clust_write}\", data: \"{data_write}\"}) {value {part, clust, data}}}"}
|
||||
|
@ -27,7 +27,7 @@ bindings:
|
||||
|
||||
# http request id
|
||||
request_id: ToHashedUUID(); ToString();
|
||||
request_token: Discard(); FirstLines("TEMPLATE(stargate_tokenfile,data/stargate_token.txt)");
|
||||
auto_gen_token: Discard(); StargateToken('http://localhost:8081/v1/auth'); ToString();
|
||||
|
||||
machine_id: Mod(<<sources:10000>>); ToHashedUUID() -> java.util.UUID
|
||||
sensor_name: HashedLineToString('data/variable_words.txt')
|
||||
@ -46,9 +46,9 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql-schema
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
body: |
|
||||
body: >2
|
||||
{"query":"mutation {\n createKeyspace(name:\"<<keyspace:gqlcf_iot>>\", replicas: <<rf:1>>, ifNotExists: true)\n}"}
|
||||
|
||||
create-table:
|
||||
@ -56,9 +56,9 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql-schema
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
body: |
|
||||
body: >2
|
||||
{"query":"mutation {\n createTable(\n keyspaceName: \"<<keyspace:gqlcf_iot>>\"\n tableName: \"<<table:iot>>\"\n partitionKeys: [{ name: \"machine_id\", type: { basic: UUID } }, { name: \"sensor_name\", type: { basic: TEXT } }]\n clusteringKeys: [{ name: \"time\", type: { basic: TIMESTAMP }, order: \"DESC\" }]\n values: [{ name: \"sensor_value\", type: { basic: FLOAT } }, { name: \"station_id\", type: { basic: UUID } }, { name: \"data\", type: { basic: TEXT } }]\n ifNotExists: true\n )\n}\n"}
|
||||
|
||||
rampup:
|
||||
@ -68,9 +68,9 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql/<<keyspace:gqlcf_iot>>
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
body: |
|
||||
body: >2
|
||||
{"query":"mutation insertReading {\n reading: insert<<table:iot>>( value: {machine_id: \"{machine_id}\", sensor_name: \"{sensor_name}\", time: \"{time}\", data: \"{data}\", sensor_value: {sensor_value}, station_id: \"{station_id}\"}) {value {machine_id, sensor_name, time, data, sensor_value, station_id}}}"}
|
||||
|
||||
main-read:
|
||||
@ -82,7 +82,7 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql/<<keyspace:gqlcf_iot>>
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
body: |
|
||||
{"query":"query readings {<<table:iot>>(value: {machine_id: \"{machine_id}\",sensor_name: \"{sensor_name}\"}, options: { pageSize: <<limit:10>> }) {values {machine_id, sensor_name, time, data, sensor_value, station_id}}}"}
|
||||
@ -96,7 +96,7 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql/<<keyspace:gqlcf_iot>>
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
body: |
|
||||
body: >2
|
||||
{"query":"mutation insertReading {\n reading: insert<<table:iot>>( value: {machine_id: \"{machine_id}\", sensor_name: \"{sensor_name}\", time: \"{time}\", data: \"{data}\", sensor_value: {sensor_value}, station_id: \"{station_id}\"}) {value {machine_id, sensor_name, time, data, sensor_value, station_id}}}"}
|
||||
|
@ -27,7 +27,7 @@ bindings:
|
||||
# http request id
|
||||
|
||||
request_id: ToHashedUUID(); ToString();
|
||||
request_token: Discard(); FirstLines("TEMPLATE(stargate_tokenfile,data/stargate_token.txt)");
|
||||
auto_gen_token: Discard(); StargateToken('http://localhost:8081/v1/auth'); ToString();
|
||||
|
||||
seq_key: Mod(<<keycount:10000000>>); ToString() -> String
|
||||
seq_value: Hash(); Mod(<<valuecount:1000000000>>); ToString() -> String
|
||||
@ -43,24 +43,24 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql-schema
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
body: |
|
||||
{
|
||||
"query":"mutation {\n createKeyspace(name: \"<<keyspace:gqlsf_keyvalue>>\", replicas: <<rf:1>>, ifNotExists: true) \n}\n"
|
||||
}
|
||||
body: >2
|
||||
{
|
||||
"query":"mutation {\n createKeyspace(name: \"<<keyspace:gqlsf_keyvalue>>\", replicas: <<rf:1>>, ifNotExists: true) \n}\n"
|
||||
}
|
||||
|
||||
create-gql-schema:
|
||||
method: POST
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql-admin
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
body: |
|
||||
{
|
||||
"query":"mutation {\n deploySchema(keyspace: \"<<keyspace:gqlsf_keyvalue>>\", schema: \"\"\"\n type KeyValue @cql_input {\n key: String! @cql_column(partitionKey: true)\n value: String!\n }\n type Query {\n getKeyValue(\n key: String!,\n ): KeyValue\n }\n type Mutation {\n \t\tinsertKeyValue(keyValue: KeyValueInput): KeyValue\n }\n \"\"\") {\n version\n }\n}\n"
|
||||
}
|
||||
body: >2
|
||||
{
|
||||
"query":"mutation {\n deploySchema(keyspace: \"<<keyspace:gqlsf_keyvalue>>\", schema: \"\"\"\n type KeyValue @cql_input {\n key: String! @cql_column(partitionKey: true)\n value: String!\n }\n type Query {\n getKeyValue(\n key: String!,\n ): KeyValue\n }\n type Mutation {\n \t\tinsertKeyValue(keyValue: KeyValueInput): KeyValue\n }\n \"\"\") {\n version\n }\n}\n"
|
||||
}
|
||||
|
||||
rampup:
|
||||
ops:
|
||||
@ -69,12 +69,12 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql/<<keyspace:gqlsf_keyvalue>>
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
body: |
|
||||
{
|
||||
"query":"mutation {\n insertKeyValue(keyValue: {key: \"{seq_key}\", value: \"{seq_value}\"}) {\n key\n value\n }\n}\n"
|
||||
}
|
||||
body: >2
|
||||
{
|
||||
"query":"mutation {\n insertKeyValue(keyValue: {key: \"{seq_key}\", value: \"{seq_value}\"}) {\n key\n value\n }\n}\n"
|
||||
}
|
||||
|
||||
main-read:
|
||||
params:
|
||||
@ -85,12 +85,12 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql/<<keyspace:gqlsf_keyvalue>>
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
body: |
|
||||
{
|
||||
"query":"{\n getKeyValue(key: \"rw_key\") {\n key\n value\n }\n}\n"
|
||||
}
|
||||
body: >2
|
||||
{
|
||||
"query":"{\n getKeyValue(key: \"rw_key\") {\n key\n value\n }\n}\n"
|
||||
}
|
||||
|
||||
main-write:
|
||||
params:
|
||||
@ -101,9 +101,9 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql/<<keyspace:gqlsf_keyvalue>>
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
body: |
|
||||
{
|
||||
"query":"mutation {\n insertKeyValue(keyValue: {key: \"{rw_key}\", value: \"{rw_value}\"}) {\n key\n value\n }\n}\n"
|
||||
}
|
||||
body: >2
|
||||
{
|
||||
"query":"mutation {\n insertKeyValue(keyValue: {key: \"{rw_key}\", value: \"{rw_value}\"}) {\n key\n value\n }\n}\n"
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ bindings:
|
||||
|
||||
# http request id
|
||||
request_id: ToHashedUUID(); ToString();
|
||||
request_token: Discard(); FirstLines("TEMPLATE(stargate_tokenfile,data/stargate_token.txt)");
|
||||
auto_gen_token: Discard(); StargateToken('http://localhost:8081/v1/auth'); ToString();
|
||||
|
||||
# for ramp-up and verify
|
||||
part_layout: Div(<<partsize:1000000>>); ToString() -> String
|
||||
@ -52,24 +52,24 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql-schema
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
body: |
|
||||
{
|
||||
"query":"mutation {\n createKeyspace(name: \"<<keyspace:gqlsf_tabular>>\", replicas: <<rf:1>>, ifNotExists: true) \n}\n"
|
||||
}
|
||||
body: >2
|
||||
{
|
||||
"query":"mutation {\n createKeyspace(name: \"<<keyspace:gqlsf_tabular>>\", replicas: <<rf:1>>, ifNotExists: true) \n}\n"
|
||||
}
|
||||
|
||||
create-gql-schema:
|
||||
method: POST
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql-admin
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
body: |
|
||||
{
|
||||
"query":"mutation {\n deploySchema(keyspace: \"<<keyspace:gqlsf_tabular>>\", schema: \"\"\"\n type Tabular @cql_input {\n part: String! @cql_column(partitionKey: true)\n clust: String! @cql_column(partitionKey: true)\n data: String! \n }\n type SelectTabularResult @cql_payload {\n \t\tdata: [Tabular]\n \t\tpagingState: String\n }\n type Query {\n getTabulars(\n part: String!,\n clust: String!,\n pagingState: String @cql_pagingState\n ): SelectTabularResult @cql_select(pageSize: 10)\n }\n type Mutation {\n \t\tinsertTabular(tabular: TabularInput): Tabular\n }\n \"\"\") {\n version\n }\n}\n"
|
||||
}
|
||||
body: >2
|
||||
{
|
||||
"query":"mutation {\n deploySchema(keyspace: \"<<keyspace:gqlsf_tabular>>\", schema: \"\"\"\n type Tabular @cql_input {\n part: String! @cql_column(partitionKey: true)\n clust: String! @cql_column(partitionKey: true)\n data: String! \n }\n type SelectTabularResult @cql_payload {\n \t\tdata: [Tabular]\n \t\tpagingState: String\n }\n type Query {\n getTabulars(\n part: String!,\n clust: String!,\n pagingState: String @cql_pagingState\n ): SelectTabularResult @cql_select(pageSize: 10)\n }\n type Mutation {\n \t\tinsertTabular(tabular: TabularInput): Tabular\n }\n \"\"\") {\n version\n }\n}\n"
|
||||
}
|
||||
|
||||
rampup:
|
||||
ops:
|
||||
@ -78,12 +78,12 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql/<<keyspace:gqlsf_tabular>>
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
body: |
|
||||
{
|
||||
"query":"mutation {\n insertTabular(tabular: {part: \"{part_layout}\", clust: \"{clust_layout}\", data: \"{data}\"}) {\n part\n clust\n data\n }\n}\n"
|
||||
}
|
||||
body: >2
|
||||
{
|
||||
"query":"mutation {\n insertTabular(tabular: {part: \"{part_layout}\", clust: \"{clust_layout}\", data: \"{data}\"}) {\n part\n clust\n data\n }\n}\n"
|
||||
}
|
||||
|
||||
main-read:
|
||||
params:
|
||||
@ -94,12 +94,12 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql/<<keyspace:gqlsf_tabular>>
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
body: |
|
||||
{
|
||||
"query":"{\n getTabulars(part: \"{part_read}\", clust: \"{clust_read}\") {\n data {\n part\n clust\n data\n }\n pagingState\n }\n}\n"
|
||||
}
|
||||
body: >2
|
||||
{
|
||||
"query":"{\n getTabulars(part: \"{part_read}\", clust: \"{clust_read}\") {\n data {\n part\n clust\n data\n }\n pagingState\n }\n}\n"
|
||||
}
|
||||
|
||||
main-write:
|
||||
params:
|
||||
@ -110,9 +110,9 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql/<<keyspace:gqlsf_tabular>>
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
body: |
|
||||
{
|
||||
"query":"mutation {\n insertTabular(tabular: {part: \"{part_write}\", clust: \"{clust_write}\", data: \"{data_write}\"}) {\n part\n clust\n data\n }\n}\n"
|
||||
}
|
||||
body: >2
|
||||
{
|
||||
"query":"mutation {\n insertTabular(tabular: {part: \"{part_write}\", clust: \"{clust_write}\", data: \"{data_write}\"}) {\n part\n clust\n data\n }\n}\n"
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ bindings:
|
||||
|
||||
# http request id
|
||||
request_id: ToHashedUUID(); ToString();
|
||||
request_token: Discard(); FirstLines("TEMPLATE(stargate_tokenfile,data/stargate_token.txt)");
|
||||
auto_gen_token: Discard(); StargateToken('http://localhost:8081/v1/auth'); ToString();
|
||||
|
||||
machine_id: Mod(<<sources:10000>>); ToHashedUUID() -> java.util.UUID
|
||||
sensor_name: HashedLineToString('data/variable_words.txt')
|
||||
@ -50,24 +50,24 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql-schema
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
body: |
|
||||
{
|
||||
"query":"mutation {\n createKeyspace(name: \"<<keyspace:gqlsf_timeseries>>\", replicas: <<rf:1>>, ifNotExists: true) \n}\n"
|
||||
}
|
||||
body: >2
|
||||
{
|
||||
"query":"mutation {\n createKeyspace(name: \"<<keyspace:gqlsf_timeseries>>\", replicas: <<rf:1>>, ifNotExists: true) \n}\n"
|
||||
}
|
||||
|
||||
create-gql-schema:
|
||||
method: POST
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql-admin
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
body: |
|
||||
{
|
||||
"query":"mutation {\n deploySchema(keyspace: \"<<keyspace:gqlsf_timeseries>>\", schema: \"\"\"\n type Iot @cql_input {\n machine_id: Uuid! @cql_column(partitionKey: true)\n sensor_name: String! @cql_column(partitionKey: true)\n time: Timestamp! @cql_column(clusteringOrder: DESC)\n sensor_value: Float!\n \tstation_id: Uuid!\n data: String!\n }\n type SelectIotResult @cql_payload {\n \t\tdata: [Iot]\n \t\tpagingState: String\n }\n type Query {\n getIots(\n machine_id: Uuid!,\n sensor_name: String!,\n pagingState: String @cql_pagingState\n ): SelectIotResult @cql_select(pageSize: 10)\n }\n type Mutation {\n \t\tinsertIot(iot: IotInput): Iot\n }\n \"\"\") {\n version\n }\n}\n"
|
||||
}
|
||||
body: >2
|
||||
{
|
||||
"query":"mutation {\n deploySchema(keyspace: \"<<keyspace:gqlsf_timeseries>>\", schema: \"\"\"\n type Iot @cql_input {\n machine_id: Uuid! @cql_column(partitionKey: true)\n sensor_name: String! @cql_column(partitionKey: true)\n time: Timestamp! @cql_column(clusteringOrder: DESC)\n sensor_value: Float!\n \tstation_id: Uuid!\n data: String!\n }\n type SelectIotResult @cql_payload {\n \t\tdata: [Iot]\n \t\tpagingState: String\n }\n type Query {\n getIots(\n machine_id: Uuid!,\n sensor_name: String!,\n pagingState: String @cql_pagingState\n ): SelectIotResult @cql_select(pageSize: 10)\n }\n type Mutation {\n \t\tinsertIot(iot: IotInput): Iot\n }\n \"\"\") {\n version\n }\n}\n"
|
||||
}
|
||||
|
||||
rampup:
|
||||
ops:
|
||||
@ -76,12 +76,12 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql/<<keyspace:gqlsf_timeseries>>
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
body: |
|
||||
{
|
||||
"query":"mutation {\n insertIot(iot: {machine_id: \"{machine_id}\", sensor_name: \"{sensor_name}\", time: \"{time}\", sensor_value: {sensor_value}, station_id: \"{station_id}\", data: \"{data}\"}) {\n machine_id\n sensor_name\n time\n sensor_value\n station_id\n data\n }\n}\n"
|
||||
}
|
||||
body: >2
|
||||
{
|
||||
"query":"mutation {\n insertIot(iot: {machine_id: \"{machine_id}\", sensor_name: \"{sensor_name}\", time: \"{time}\", sensor_value: {sensor_value}, station_id: \"{station_id}\", data: \"{data}\"}) {\n machine_id\n sensor_name\n time\n sensor_value\n station_id\n data\n }\n}\n"
|
||||
}
|
||||
|
||||
main-read:
|
||||
params:
|
||||
@ -92,12 +92,12 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql/<<keyspace:gqlsf_timeseries>>
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
body: |
|
||||
{
|
||||
"query":"{\n getIots(machine_id: \"{machine_id}\", sensor_name: \"{sensor_name}\") {\n data {\n machine_id\n sensor_name\n time\n sensor_value\n station_id\n data\n }\n }\n}\n"
|
||||
}
|
||||
body: >2
|
||||
{
|
||||
"query":"{\n getIots(machine_id: \"{machine_id}\", sensor_name: \"{sensor_name}\") {\n data {\n machine_id\n sensor_name\n time\n sensor_value\n station_id\n data\n }\n }\n}\n"
|
||||
}
|
||||
|
||||
main-write:
|
||||
params:
|
||||
@ -108,9 +108,9 @@ blocks:
|
||||
uri: <<protocol:http>>://{weighted_hosts}:<<graphql_port:8080>><<path_prefix:>>/graphql/<<keyspace:gqlsf_timeseries>>
|
||||
Accept: "application/json"
|
||||
X-Cassandra-Request-Id: "{request_id}"
|
||||
X-Cassandra-Token: "{request_token}"
|
||||
X-Cassandra-Token: "<<auth_token:{auto_gen_token}>>"
|
||||
Content-Type: "application/json"
|
||||
body: |
|
||||
{
|
||||
"query":"mutation {\n insertIot(iot: {machine_id: \"{machine_id}\", sensor_name: \"{sensor_name}\", time: \"{time}\", sensor_value: {sensor_value}, station_id: \"{station_id}\", data: \"{data}\"}) {\n machine_id\n sensor_name\n time\n sensor_value\n station_id\n data\n }\n}\n"
|
||||
}
|
||||
body: >2
|
||||
{
|
||||
"query":"mutation {\n insertIot(iot: {machine_id: \"{machine_id}\", sensor_name: \"{sensor_name}\", time: \"{time}\", sensor_value: {sensor_value}, station_id: \"{station_id}\", data: \"{data}\"}) {\n machine_id\n sensor_name\n time\n sensor_value\n station_id\n data\n }\n}\n"
|
||||
}
|
||||
|
@ -48,6 +48,7 @@
|
||||
<dependency>
|
||||
<groupId>com.github.docker-java</groupId>
|
||||
<artifactId>docker-java-core</artifactId>
|
||||
<version>3.3.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
@ -39,7 +39,7 @@
|
||||
<dependency>
|
||||
<groupId>io.swagger.parser.v3</groupId>
|
||||
<artifactId>swagger-parser</artifactId>
|
||||
<version>2.1.11</version>
|
||||
<version>2.1.12</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
@ -244,7 +244,7 @@
|
||||
<dependency>
|
||||
<groupId>com.github.docker-java</groupId>
|
||||
<artifactId>docker-java-core</artifactId>
|
||||
<version>3.2.14</version>
|
||||
<version>3.3.0</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.slf4j</groupId>
|
||||
|
@ -14,7 +14,8 @@
|
||||
~ limitations under the License.
|
||||
-->
|
||||
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>virtdata-lib-basics</artifactId>
|
||||
@ -69,6 +70,18 @@
|
||||
<artifactId>number-to-words</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-core</artifactId>
|
||||
<version>5.1.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-junit-jupiter</artifactId>
|
||||
<version>5.1.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright (c) 2023 nosqlbench
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.nosqlbench.virtdata.library.basics.shared.unary_string;
|
||||
|
||||
import io.nosqlbench.api.errors.BasicError;
|
||||
import io.nosqlbench.virtdata.api.annotations.Categories;
|
||||
import io.nosqlbench.virtdata.api.annotations.Category;
|
||||
import io.nosqlbench.virtdata.api.annotations.ThreadSafeMapper;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
// The intention is to have a shared function that can simply mirror the input for cases where
|
||||
// defaults and conditions are evaluated as part of an overall binding value.
|
||||
// E.g. MirrorToString(<<foo:bar>>);
|
||||
@ThreadSafeMapper
|
||||
@Categories({Category.conversion})
|
||||
public class MirrorToString implements Function<String, String> {
|
||||
|
||||
private String input;
|
||||
|
||||
private MirrorToString() {
|
||||
}
|
||||
|
||||
public MirrorToString(String input) throws BasicError {
|
||||
if (input == null) {
|
||||
throw new BasicError("Must supply input String to mirror.");
|
||||
}
|
||||
this.input = input;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String apply(String placeholder) {
|
||||
return input;
|
||||
}
|
||||
}
|
@ -0,0 +1,148 @@
|
||||
/*
|
||||
* Copyright (c) 2023 nosqlbench
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package io.nosqlbench.virtdata.library.basics.shared.unary_string;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import io.nosqlbench.api.errors.BasicError;
|
||||
import io.nosqlbench.virtdata.api.annotations.Categories;
|
||||
import io.nosqlbench.virtdata.api.annotations.Category;
|
||||
import io.nosqlbench.virtdata.api.annotations.ThreadSafeMapper;
|
||||
import io.nosqlbench.virtdata.library.basics.shared.util.Credentials;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.net.URI;
|
||||
import java.net.http.HttpClient;
|
||||
import java.net.http.HttpRequest;
|
||||
import java.net.http.HttpResponse;
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
import java.util.function.Function;
|
||||
|
||||
|
||||
@ThreadSafeMapper
|
||||
@Categories({Category.general})
|
||||
public class StargateToken implements Function<Object, String> {
|
||||
|
||||
private static final Logger logger = LogManager.getLogger(StargateToken.class);
|
||||
private final Credentials credentials;
|
||||
private final String url;
|
||||
private final HttpClient httpClient;
|
||||
|
||||
|
||||
public StargateToken(String url) throws SecurityException {
|
||||
this(url, Credentials.defaultCredentials());
|
||||
}
|
||||
|
||||
public StargateToken(String url, Credentials credentials) throws SecurityException {
|
||||
this(url, credentials, HttpClient.newBuilder().build());
|
||||
}
|
||||
|
||||
public StargateToken(String url, Credentials credentials, HttpClient client) throws SecurityException {
|
||||
this.url = url;
|
||||
this.credentials = credentials;
|
||||
this.httpClient = client;
|
||||
if (TokenKeeper.isExpired()) {
|
||||
authTokenStargate(url, credentials);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String apply(Object value) throws SecurityException {
|
||||
if (TokenKeeper.isExpired()) {
|
||||
authTokenStargate(url, credentials);
|
||||
}
|
||||
return TokenKeeper.token;
|
||||
}
|
||||
|
||||
public static void setExpired() {
|
||||
TokenKeeper.isExpiredRequested = true;
|
||||
}
|
||||
|
||||
private void authTokenStargate(String url, Credentials credentials) throws SecurityException {
|
||||
|
||||
if (credentials == null || url == null) {
|
||||
throw new BasicError("Must provide url and credentials to obtain authTokenStargate");
|
||||
}
|
||||
logger.debug("Received url for Stargate auth token request: {} ", url);
|
||||
|
||||
try {
|
||||
final Gson gson = new Gson();
|
||||
HttpRequest.Builder builder = HttpRequest.newBuilder();
|
||||
builder = builder.uri(URI.create(url));
|
||||
builder = builder.POST(HttpRequest.BodyPublishers.ofString(gson.toJson(credentials)));
|
||||
builder.setHeader("Content-Type", "application/json");
|
||||
|
||||
HttpRequest request = builder.build();
|
||||
HttpResponse<String> resp = httpClient.send(request, HttpResponse.BodyHandlers.ofString());
|
||||
|
||||
logger.debug(() -> "Stargate response status code: " + resp.statusCode());
|
||||
|
||||
if (resp.statusCode() != 201) {
|
||||
final String errorMessage = "Unable to obtain expected auth token, with status code: "
|
||||
+ resp.statusCode() + " :" + resp.body();
|
||||
logger.error(() -> errorMessage);
|
||||
throw new BasicError(errorMessage);
|
||||
}
|
||||
|
||||
Credentials retrievedToken = gson.fromJson(resp.body(), Credentials.class);
|
||||
TokenKeeper.setToken(retrievedToken.getAuthToken());
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new SecurityException("Auth Token error, stargate-token retrieval failure", e);
|
||||
}
|
||||
}
|
||||
|
||||
public static final class TokenKeeper {
|
||||
private static final long TOKEN_EXPIRE_MIN = 30;
|
||||
private static String token;
|
||||
private static boolean isExpiredRequested = true;
|
||||
private static Instant lastTokenInstant = Instant.now();
|
||||
|
||||
private TokenKeeper() {
|
||||
}
|
||||
|
||||
public static void reset() {
|
||||
token = null;
|
||||
isExpiredRequested = true;
|
||||
lastTokenInstant = Instant.now();
|
||||
}
|
||||
|
||||
public static void setToken(String input) {
|
||||
token = input;
|
||||
}
|
||||
|
||||
public static String getToken() {
|
||||
return token;
|
||||
}
|
||||
|
||||
public static Instant lastTokenInstant() {
|
||||
return lastTokenInstant;
|
||||
}
|
||||
|
||||
public static boolean isExpired() {
|
||||
|
||||
if (isExpiredRequested || Duration.between(Instant.now(),
|
||||
lastTokenInstant).toMinutes() > TOKEN_EXPIRE_MIN) {
|
||||
logger.trace("Token expiry detected.");
|
||||
lastTokenInstant = Instant.now();
|
||||
isExpiredRequested = false;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
|
||||
/*
|
||||
* Copyright (c) 2023 nosqlbench
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package io.nosqlbench.virtdata.library.basics.shared.util;
|
||||
|
||||
public class Credentials {
|
||||
|
||||
private static final String DEFAULT_IDENTITY = "cassandra";
|
||||
private String username;
|
||||
private String password;
|
||||
private String authToken;
|
||||
|
||||
public static Credentials defaultCredentials() {
|
||||
return new Credentials(DEFAULT_IDENTITY, DEFAULT_IDENTITY);
|
||||
}
|
||||
|
||||
public Credentials(String username, String password) {
|
||||
this.username = username;
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
// Added for support of auth tokens not obtained via defaultCredentials
|
||||
public Credentials(String authToken) {
|
||||
this.authToken = authToken;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public String getAuthToken() {
|
||||
return authToken;
|
||||
}
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
package io.nosqlbench.virtdata.library.basics.shared.unary_string;
|
||||
|
||||
import io.nosqlbench.api.errors.BasicError;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
||||
|
||||
/*
|
||||
* Copyright (c) 2023 nosqlbench
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
public class MirrorToStringTest {
|
||||
|
||||
@Test
|
||||
void mirrorTest() {
|
||||
|
||||
final MirrorToString mts = new MirrorToString("mirror-this");
|
||||
|
||||
assertThat(mts.apply(new String())).isNotNull();
|
||||
assertThat(mts.apply(new String())).isEqualTo("mirror-this");
|
||||
assertThatExceptionOfType(BasicError.class).isThrownBy(() -> new MirrorToString(null));
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,148 @@
|
||||
/*
|
||||
* Copyright (c) 2023 nosqlbench
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.nosqlbench.virtdata.library.basics.shared.unary_string;
|
||||
|
||||
import io.nosqlbench.virtdata.library.basics.shared.util.Credentials;
|
||||
import org.apache.commons.lang3.reflect.FieldUtils;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.Mockito;
|
||||
import org.mockito.internal.util.reflection.FieldReader;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
import org.mockito.junit.jupiter.MockitoSettings;
|
||||
import org.mockito.quality.Strictness;
|
||||
|
||||
import java.net.http.HttpClient;
|
||||
import java.net.http.HttpRequest;
|
||||
import java.net.http.HttpResponse;
|
||||
import java.time.Instant;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
@MockitoSettings(strictness = Strictness.LENIENT)
|
||||
class StargateTokenTest extends TokenTest {
|
||||
|
||||
private static final String TEST_AUTH_TOKEN = "8675309";
|
||||
private static final String VALID_TEST_URL = "http://foobar.com:8675";
|
||||
private static final String VALID_STARGATE_AUTH_TOKEN_RESPONSE_JSON =
|
||||
"{ 'authToken': " + "\"" + TEST_AUTH_TOKEN + "\"" + "}";
|
||||
private static final Credentials VALID_TEST_CREDS = new Credentials("username", "password");
|
||||
|
||||
private static final Object TOKEN_APPLY_PLACEHOLDER = new Object();
|
||||
@Mock
|
||||
private static HttpResponse<String> httpResponse;
|
||||
@Mock
|
||||
private static HttpClient httpClient;
|
||||
|
||||
@BeforeAll
|
||||
public static void init() {
|
||||
httpResponse = mock(HttpResponse.class);
|
||||
httpClient = mock(HttpClient.class);
|
||||
}
|
||||
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
StargateToken.TokenKeeper.reset();
|
||||
}
|
||||
|
||||
@Test
|
||||
void applyTokenSuccess() throws Exception {
|
||||
|
||||
when(httpResponse.body()).thenReturn(VALID_STARGATE_AUTH_TOKEN_RESPONSE_JSON);
|
||||
when(httpResponse.statusCode()).thenReturn(201);
|
||||
when(httpClient.send(Mockito.any(HttpRequest.class),
|
||||
Mockito.any(HttpResponse.BodyHandlers.ofString().getClass())))
|
||||
.thenReturn(httpResponse);
|
||||
|
||||
final StargateToken stargateToken = new StargateToken(VALID_TEST_URL,
|
||||
VALID_TEST_CREDS, httpClient);
|
||||
final String result = stargateToken.apply(TOKEN_APPLY_PLACEHOLDER);
|
||||
|
||||
assertThat(result).isEqualTo(TEST_AUTH_TOKEN);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
void receivedResponse500() throws Exception {
|
||||
|
||||
when(httpResponse.body()).thenReturn(VALID_STARGATE_AUTH_TOKEN_RESPONSE_JSON);
|
||||
when(httpResponse.statusCode()).thenReturn(500);
|
||||
when(httpClient.send(Mockito.any(HttpRequest.class), Mockito.any(HttpResponse.BodyHandlers.ofString()
|
||||
.getClass())))
|
||||
.thenReturn(httpResponse);
|
||||
|
||||
assertThatExceptionOfType(SecurityException.class).isThrownBy(() -> new StargateToken(VALID_TEST_URL,
|
||||
VALID_TEST_CREDS, httpClient));
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
void applyTokenSuccessWithRefreshTokenRequested() throws Exception {
|
||||
|
||||
// --- Initial check
|
||||
StargateToken.TokenKeeper.reset();
|
||||
|
||||
when(httpResponse.body()).thenReturn(VALID_STARGATE_AUTH_TOKEN_RESPONSE_JSON);
|
||||
when(httpResponse.statusCode()).thenReturn(201);
|
||||
when(httpClient.send(Mockito.any(HttpRequest.class),
|
||||
Mockito.any(HttpResponse.BodyHandlers.ofString()
|
||||
.getClass())))
|
||||
.thenReturn(httpResponse);
|
||||
|
||||
final StargateToken stargateToken = new StargateToken(VALID_TEST_URL, VALID_TEST_CREDS, httpClient);
|
||||
final String resultFirstCheck = stargateToken.apply(TOKEN_APPLY_PLACEHOLDER);
|
||||
final Instant tokenInstantFirstCheck = StargateToken.TokenKeeper.lastTokenInstant();
|
||||
|
||||
assertThat(resultFirstCheck).isEqualTo(TEST_AUTH_TOKEN);
|
||||
assertThat(tokenInstantFirstCheck).isNotNull();
|
||||
|
||||
// --- Subtest 2 - When NOT having an expired token, expect that the lastTokenInstant does NOT change.
|
||||
when(httpResponse.body()).thenReturn("{ 'authToken': " + "\"" + "refreshed-token" + "\"" + "}");
|
||||
when(httpResponse.statusCode()).thenReturn(201);
|
||||
when(httpClient.send(Mockito.any(HttpRequest.class), Mockito.any(HttpResponse.BodyHandlers.ofString()
|
||||
.getClass())))
|
||||
.thenReturn(httpResponse);
|
||||
|
||||
final String resultSecondCheck = stargateToken.apply(TOKEN_APPLY_PLACEHOLDER);
|
||||
final Instant tokenInstantSecondCheck = StargateToken.TokenKeeper.lastTokenInstant();
|
||||
|
||||
assertThat(resultSecondCheck).isEqualTo(resultFirstCheck);
|
||||
assertThat(tokenInstantSecondCheck).isEqualTo(tokenInstantFirstCheck);
|
||||
|
||||
// --- Subtest 3 - When having an expired token, expect that the lastTokenInstant changes and
|
||||
// tokens are different.
|
||||
// Note: Explicit token expiry, default is 30 minutes
|
||||
StargateToken.setExpired();
|
||||
|
||||
final String resultThirdCheck = stargateToken.apply(TOKEN_APPLY_PLACEHOLDER);
|
||||
final FieldReader fileReaderLastCheck = new FieldReader(stargateToken,
|
||||
FieldUtils.getDeclaredField(StargateToken.class,
|
||||
"lastTokenInstant", true));
|
||||
final Instant tokenInstantThirdCheck = StargateToken.TokenKeeper.lastTokenInstant();
|
||||
|
||||
assertThat(tokenInstantThirdCheck.isAfter(tokenInstantFirstCheck)).isTrue();
|
||||
assertThat(resultSecondCheck).isNotEqualTo(resultThirdCheck);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Copyright (c) 2023 nosqlbench
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package io.nosqlbench.virtdata.library.basics.shared.unary_string;
|
||||
|
||||
public abstract class TokenTest {
|
||||
// Intent is to expand for generic (non-Stargate) http-rest test conditions and utils.
|
||||
}
|
Loading…
Reference in New Issue
Block a user