-
Notifications
You must be signed in to change notification settings - Fork 185
READY: Add Timeseries support #416
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
d527055
a75843b
3de1e7f
b40078b
9de23fd
a8227e1
454ba86
4551e14
a4ab50c
867ff63
c268e6a
aece9f3
429b5fd
b2b15e7
9cba451
2c59f20
bac106c
2549944
d46c940
5f738c5
0bcebd7
7330d75
a48cb91
33862c1
e226683
19454a2
a48020d
6ae0494
fdec441
c4eaa20
57c47c0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,8 @@ | ||
| *.pyc | ||
| .python-version | ||
|
|
||
| .tox/ | ||
|
|
||
| docs/_build | ||
|
|
||
| .*.swp | ||
|
|
||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| for pbin in .tox/*/bin | ||
| do | ||
| echo $pbin | ||
| pip="$pbin/pip" | ||
| $pip uninstall riak_pb --yes | ||
| $pip uninstall riak --yes | ||
| $pip uninstall protobuf --yes | ||
| $pip uninstall python3-riak-pb --yes | ||
| $pip uninstall python3-protobuf --yes | ||
| echo ----- | ||
| done |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,8 +11,10 @@ | |
| import os.path | ||
|
|
||
|
|
||
| __all__ = ['create_bucket_types', 'setup_security', 'enable_security', | ||
| 'disable_security', 'preconfigure', 'configure'] | ||
| __all__ = ['create_bucket_types', | ||
| 'setup_security', 'enable_security', 'disable_security', | ||
| 'setup_timeseries', | ||
| 'preconfigure', 'configure'] | ||
|
|
||
|
|
||
| # Exception classes used by this module. | ||
|
|
@@ -73,35 +75,7 @@ def check_output(*popenargs, **kwargs): | |
| import json | ||
|
|
||
|
|
||
| class create_bucket_types(Command): | ||
| """ | ||
| Creates bucket-types appropriate for testing. By default this will create: | ||
|
|
||
| * `pytest-maps` with ``{"datatype":"map"}`` | ||
| * `pytest-sets` with ``{"datatype":"set"}`` | ||
| * `pytest-counters` with ``{"datatype":"counter"}`` | ||
| * `pytest-consistent` with ``{"consistent":true}`` | ||
| * `pytest-write-once` with ``{"write_once": true}`` | ||
| * `pytest-mr` | ||
| * `pytest` with ``{"allow_mult":false}`` | ||
| """ | ||
|
|
||
| description = "create bucket-types used in integration tests" | ||
|
|
||
| user_options = [ | ||
| ('riak-admin=', None, 'path to the riak-admin script') | ||
| ] | ||
|
|
||
| _props = { | ||
| 'pytest-maps': {'datatype': 'map'}, | ||
| 'pytest-sets': {'datatype': 'set'}, | ||
| 'pytest-counters': {'datatype': 'counter'}, | ||
| 'pytest-consistent': {'consistent': True}, | ||
| 'pytest-write-once': {'write_once': True}, | ||
| 'pytest-mr': {}, | ||
| 'pytest': {'allow_mult': False} | ||
| } | ||
|
|
||
| class bucket_type_commands: | ||
| def initialize_options(self): | ||
| self.riak_admin = None | ||
|
|
||
|
|
@@ -171,6 +145,66 @@ def _btype_command(self, *args): | |
| return cmd | ||
|
|
||
|
|
||
| class create_bucket_types(bucket_type_commands, Command): | ||
| """ | ||
| Creates bucket-types appropriate for testing. By default this will create: | ||
|
|
||
| * `pytest-maps` with ``{"datatype":"map"}`` | ||
| * `pytest-sets` with ``{"datatype":"set"}`` | ||
| * `pytest-counters` with ``{"datatype":"counter"}`` | ||
| * `pytest-consistent` with ``{"consistent":true}`` | ||
| * `pytest-write-once` with ``{"write_once": true}`` | ||
| * `pytest-mr` | ||
| * `pytest` with ``{"allow_mult":false}`` | ||
| """ | ||
|
|
||
| description = "create bucket-types used in integration tests" | ||
|
|
||
| user_options = [ | ||
| ('riak-admin=', None, 'path to the riak-admin script') | ||
| ] | ||
|
|
||
| _props = { | ||
| 'pytest-maps': {'datatype': 'map'}, | ||
| 'pytest-sets': {'datatype': 'set'}, | ||
| 'pytest-counters': {'datatype': 'counter'}, | ||
| 'pytest-consistent': {'consistent': True}, | ||
| 'pytest-write-once': {'write_once': True}, | ||
| 'pytest-mr': {}, | ||
| 'pytest': {'allow_mult': False} | ||
| } | ||
|
|
||
|
|
||
| class setup_timeseries(bucket_type_commands, Command): | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why create a new class just for timeseries? Seems like you could create other classes for, say, datatypes to be consistent. Is there some special behavior here?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I figured since TS isn't a real thing yet it would be nice to keep it separate and skippable. |
||
| """ | ||
| Creates bucket-types appropriate for timeseries. | ||
| """ | ||
|
|
||
| description = "create bucket-types used in timeseries tests" | ||
|
|
||
| user_options = [ | ||
| ('riak-admin=', None, 'path to the riak-admin script') | ||
| ] | ||
|
|
||
| _props = { | ||
| 'GeoCheckin': { | ||
| 'n_val': 3, | ||
| 'table_def': ''' | ||
| CREATE TABLE GeoCheckin ( | ||
| geohash varchar not null, | ||
| user varchar not null, | ||
| time timestamp not null, | ||
| weather varchar not null, | ||
| temperature double, | ||
| PRIMARY KEY( | ||
| (geohash, user, quantum(time, 15, m)), | ||
| geohash, user, time | ||
| ) | ||
| )''' | ||
| } | ||
| } | ||
|
|
||
|
|
||
| class security_commands(object): | ||
| def check_security_command(self, *args): | ||
| cmd = self._security_command(*args) | ||
|
|
@@ -396,9 +430,9 @@ def _update_riak_conf(self): | |
| https_host = self.host + ':' + self.https_port | ||
| pb_host = self.host + ':' + self.pb_port | ||
| self._backup_file(self.riak_conf) | ||
| f = open(self.riak_conf, 'r', buffering=1) | ||
| conf = f.read() | ||
| f.close() | ||
| conf = None | ||
| with open(self.riak_conf, 'r', buffering=1) as f: | ||
| conf = f.read() | ||
| conf = re.sub(r'search\s+=\s+off', r'search = on', conf) | ||
| conf = re.sub(r'##[ ]+ssl\.', r'ssl.', conf) | ||
| conf = re.sub(r'ssl.certfile\s+=\s+\S+', | ||
|
|
@@ -427,9 +461,8 @@ def _update_riak_conf(self): | |
| # Older versions of OpenSSL client library need to match on the server | ||
| conf += 'tls_protocols.tlsv1 = on\n' | ||
| conf += 'tls_protocols.tlsv1.1 = on\n' | ||
| f = open(self.riak_conf, 'w', buffering=1) | ||
| f.write(conf) | ||
| f.close() | ||
| with open(self.riak_conf, 'w', buffering=1) as f: | ||
| f.write(conf) | ||
|
|
||
| def _backup_file(self, name): | ||
| backup = name + ".bak" | ||
|
|
@@ -469,6 +502,4 @@ def run(self): | |
| for cmd_name in self.get_sub_commands(): | ||
| self.run_command(cmd_name) | ||
|
|
||
| sub_commands = [('create_bucket_types', None), | ||
| ('setup_security', None) | ||
| ] | ||
| sub_commands = [('create_bucket_types', None), ('setup_security', None)] | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, but don't we already have a
THANKSfile?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah! I'll move those here ... that's what @mjbrender has had us do with the other clients. I know one unit test reads the THANKS file so I'll address that.