summaryrefslogtreecommitdiffstats
path: root/src/test/neorados/test_neorados.cc
blob: 953e772e115b454a223190dbc35f2e1caf673a94 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab

#include "include/rados/librados.hpp"
#include "include/neorados/RADOS.hpp"
#include "common/async/blocked_completion.h"
#include "test/librados/test_cxx.h"
#include "gtest/gtest.h"
#include <iostream>

namespace neorados {

class TestNeoRADOS : public ::testing::Test {
public:
  TestNeoRADOS() {
  }
};

TEST_F(TestNeoRADOS, MakeWithLibRADOS) {
  librados::Rados paleo_rados;
  auto result = connect_cluster_pp(paleo_rados);
  ASSERT_EQ("", result);

  auto rados = RADOS::make_with_librados(paleo_rados);

  ReadOp op;
  bufferlist bl;
  op.read(0, 0, &bl);

  // provide pool that doesn't exists -- just testing round-trip
  ASSERT_THROW(
    rados.execute({"dummy-obj"}, std::numeric_limits<int64_t>::max(),
                  std::move(op), nullptr, ceph::async::use_blocked),
    boost::system::system_error);
}

} // namespace neorados

int main(int argc, char **argv) {
  ::testing::InitGoogleTest(&argc, argv);

  int seed = getpid();
  std::cout << "seed " << seed << std::endl;
  srand(seed);

  return RUN_ALL_TESTS();
}