summaryrefslogtreecommitdiffstats
path: root/src/test/librados/cls.cc
blob: c4f24954dbe1196a5d98c16fa60324f63271dffc (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
#include <errno.h>
#include <map>
#include <sstream>
#include <string>

#include "gtest/gtest.h"

#include "include/rados/librados.hpp"
#include "test/librados/test_cxx.h"

using namespace librados;
using std::map;
using std::ostringstream;
using std::string;

TEST(LibRadosCls, DNE) {
  Rados cluster;
  std::string pool_name = get_temp_pool_name();
  ASSERT_EQ("", create_one_pool_pp(pool_name, cluster));
  IoCtx ioctx;
  cluster.ioctx_create(pool_name.c_str(), ioctx);

  // create an object
  string oid = "foo";
  bufferlist bl;
  ASSERT_EQ(0, ioctx.write(oid, bl, bl.length(), 0));

  // call a bogus class
  ASSERT_EQ(-EOPNOTSUPP, ioctx.exec(oid, "doesnotexistasdfasdf", "method", bl, bl));

  // call a bogus method on existent class
  ASSERT_EQ(-EOPNOTSUPP, ioctx.exec(oid, "lock", "doesnotexistasdfasdfasdf", bl, bl));

  ioctx.close();
  ASSERT_EQ(0, destroy_one_pool_pp(pool_name, cluster));
}