Commit Graph

78 Commits

Author SHA1 Message Date
Sven Anderson af5a9e9906 rados: remove unused constant
Signed-off-by: Sven Anderson <sven@redhat.com>
2021-09-16 13:47:56 +00:00
Sven Anderson 54fe45484a rados: remove errcheck linter warnings
Signed-off-by: Sven Anderson <sven@redhat.com>
2021-09-16 13:47:56 +00:00
Sven Anderson b7f01be284 rados: remove ineffassign linter warnings
Signed-off-by: Sven Anderson <sven@redhat.com>
2021-09-16 13:47:56 +00:00
Sven Anderson ff75b9c2a2 rados: add missing error asserts
Signed-off-by: Sven Anderson <sven@redhat.com>
2021-09-14 14:14:23 +00:00
John Mulligan c658cc93a9 rados: import testify suite as tsuite
This avoids import shadowing elsewhere in rados_test.go.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-09-13 15:13:53 +00:00
John Mulligan 615b122e49 rados: naming conventions: fixes in test func TestListAcrossNamespaces
Fix up variable names that don't meet Go standards.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-08-23 15:28:00 +00:00
John Mulligan 5506545be0 rados: naming conventions: fixes in test function TestSetNamespace
Fix up variable names that don't meet Go standards.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-08-23 15:28:00 +00:00
John Mulligan 35bcee9804 rados: naming conventions: fixes in test funcs TestObjectIterator*
Fix up variable names that don't meet Go standards.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-08-23 15:28:00 +00:00
John Mulligan ef031dddcf rados: naming conventions: fixes in test function TestGetPoolStats
Fix up variable names that don't meet Go standards.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-08-23 15:28:00 +00:00
John Mulligan a15c91d711 rados: naming conventions: fixes in test function TestCreate
Fix up variable names that don't meet Go standards.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-08-23 15:28:00 +00:00
John Mulligan b045c8b239 rados: naming conventions: fixes in test funcs TestGetPoolBy{Name,ID}
Fix up variable names that don't meet Go standards.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-08-23 15:28:00 +00:00
John Mulligan 810022af7b rados: naming conventions: fixes in test function TestMakeDeletePool
Fix up variable names that don't meet Go standards.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-08-23 15:28:00 +00:00
John Mulligan e3196e45e0 rados: naming conventions: fixes in test function TestGetClusterStats
Fix up variable names that don't meet Go standards.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-08-23 15:28:00 +00:00
John Mulligan 9d7d31d158 rados: naming conventions: fixes in test functions for config
Fix up variable names that don't meet Go standards.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-08-23 15:28:00 +00:00
Mudit Agarwal 76e4089806 rados: move GetNamespace() to rados/ioctx.go
Now, we don't support ceph versions < nautilus this function
can move to a generic file so that nautilus specific functions
can be written here. Moved GetNamespace() and the corresponding
test function.

Signed-off-by: Mudit Agarwal <muagarwa@redhat.com>
2021-06-02 06:16:01 +00:00
John Mulligan edcee808b1 rados: add GetLastVersion implementing rados_get_last_version
The GetLastVersion returns a number representing the most recent
read/write version for the io context.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-07-31 09:17:38 -04:00
Mudit Agarwal 837777d3fc rados: add wrapper for the function rados_ioctx_get_id()
Implements GetPoolID() and test case around the same.

Signed-off-by: Mudit Agarwal <muagarwa@redhat.com>
2020-07-24 10:48:18 -04:00
John Mulligan a50c60be49 rados: add a more direct argv config wrapper ParseConfigArgv
Previously, ParseCmdLineArgs was the function directly wrapping the
ceph rados_conf_parse_argv function. This function has the improper
(IMO) behavior of assuming you didn't know your own argv[0] and just
always stuck "placeholder" in argv[0]. This function adds a more
direct wrapper ParseConfigArgv that allows the caller to pass an
full argv, and they can put any placholder value desired if they want.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-07-24 09:54:04 -04:00
John Mulligan 79dfe8e631 rados: move *Command functions into a separate file
Organize the rados package a bit more by moving functions that wrap
rados_xyz_command functions into a dedicated file. Move related test to
a separate file as well.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-04-27 14:38:16 -04:00
John Mulligan 20311caff5 rados: check errors in test when deleting pools
Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-04-09 13:11:05 -04:00
John Mulligan a1de43cd5d rados: improve clean up of temporary file used in test
Clean up the temporary file using a defer and make sure that the
errors returned by the functions in the defer func are checked.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-04-09 13:11:05 -04:00
John Mulligan c4f8f0445a rados: check errors returned by Write calls
Don't ignore errors returned by ioctx Write function calls.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-04-09 13:11:05 -04:00
John Mulligan 38adf053dd rados: check errors returned when reading config
Don't ignore the error return from ReadDefaultConfigFile.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-04-09 13:11:05 -04:00
John Mulligan 1f4543e835 rados: consolidate error types & values in an errors.go file
Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-04-06 17:10:09 -04:00
John Mulligan 1bd65c6f20 rados: fix test for mon command with input buffer on ceph octopus
It appears that ceph octopus (currently testing as master) is stricter
about some inputs and the old formatting in the test was failing.
Use formatting that all versions should be happy with.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-03-12 13:33:16 +01:00
Niels de Vos 5adb04909d rados: standardize error naming
RadosError-prefixes are not recommended, instead just Err as prefix is
used.

Also, errors are constants, not variables.

For existing users, backwards compatible constants are available. These
will need to be removed in a future go-ceph release.

Signed-off-by: Niels de Vos <ndevos@redhat.com>
2020-01-29 16:51:49 +01:00
Niels de Vos c6b65af9ec rados: add Create() function to create new objects
Signed-off-by: Niels de Vos <ndevos@redhat.com>
2020-01-29 16:51:49 +01:00
John Mulligan de60dcb33b rados: add a test case for the >4086 buffer code path in ListPools
The code path where the pools result buffer was increased in size
then re-fetched was not being tested. Test it.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-01-23 07:45:35 +01:00
John Mulligan 15dfd6fc09 rados: reduce boilerplate in TestGetPoolByName using testify
Testfiy's assert and require libs have helpful functions for
checking values. Use them to reduce a bunch of boilerplate code in the
TestGetPoolByName function.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-01-23 07:45:35 +01:00
John Mulligan b5a0045d70 rados: add test coverage for failure to get config option
Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-01-23 07:45:35 +01:00
John Mulligan b8f04da105 rados: add test coverage for failure to open io context
Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-01-23 07:45:35 +01:00
John Mulligan dd1e25e5a4 rados: test error condition in PingMonitor
Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-01-23 07:45:35 +01:00
John Mulligan df46476e21 rados: make get rados error a private function
There is no good reason why the internal error handling support should
be exposed outside the rados package. Make the function lower-cased and
thus private.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-01-22 10:35:02 +01:00
John Mulligan d51628ca59 rados: update test setup code to avoid blocking forever
When working on the previous rbd change it was determined that the
connection setup code would block forever if the ceph config was missing
or bad when running the tests. Adjust the connection setup in the rados
pkg such that the tests will not block forever.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-01-20 16:52:45 +01:00
John Mulligan d4b6798928 rados: add test function for error type and functions
Signed-off-by: John Mulligan <jmulligan@redhat.com>
2019-12-16 16:59:25 +01:00
John Mulligan 8a2d18be87 rados: include rados_test.go in rados package
Keeping the _test.go code in the same package allows for the testing
of private functions. AFAIK it is more conventional as well.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2019-12-16 09:49:47 +01:00
Yue Zhu 750fe1830e rados: add support for sending PG commands 2019-12-13 16:30:00 +01:00
Niels de Vos 43a863d1cb Add GetPoolByID() for calling rados_pool_reverse_lookup()
Signed-off-by: Niels de Vos <ndevos@redhat.com>
2019-11-01 14:40:47 -04:00
Niels de Vos bcf44fc782 Add GetPoolByName() for calling rados_pool_lookup()
Signed-off-by: Niels de Vos <ndevos@redhat.com>
2019-11-01 14:40:47 -04:00
Noah Watkins fe9a93bb73 rados: migrate remaining tests to suite interface
Signed-off-by: Noah Watkins <nwatkins@redhat.com>
2018-09-14 14:35:45 -07:00
Noah Watkins a1c3394414 test: convert more tests to use suite
Signed-off-by: Noah Watkins <nwatkins@redhat.com>
2018-08-22 10:58:45 -07:00
Noah Watkins fad63ff1f9 test: convert more tests to use suite
Signed-off-by: Noah Watkins <nwatkins@redhat.com>
2018-08-17 11:51:36 -07:00
Noah Watkins 7b5a27ca9a rados: refactor tests to use testing suite
Signed-off-by: Noah Watkins <nwatkins@redhat.com>
2018-08-09 07:34:43 -07:00
Noah Watkins 6363bf77ae rados: use test suite to share code
Signed-off-by: Noah Watkins <nwatkins@redhat.com>
2018-08-07 18:48:17 -07:00
Michael Andersen 59cdfdc5a4 rados: improve support for namespaces 2018-02-03 10:59:54 -08:00
Damien Tournoud 03facd6d90 Fix bogus duration handling in IOContext.Lock*
Signed-off-by: Damien Tournoud <damien@platform.sh>
2017-07-28 16:32:25 +02:00
Michael Andersen f40720f238 Add test for ENOENT for omap 2017-01-12 17:49:01 -08:00
Emmet Cassidy 628bae93d1 rados: add support for object locking + test 2016-08-03 15:50:34 -07:00
Jared Watts c08104a20f Add support for mon_command input buffer 2016-07-21 13:07:30 -07:00
Noah Watkins 8c0703f5e2 Merge remote-tracking branch 'origin/pr/15' 2016-03-26 11:52:02 -07:00