def test_call(cluster, module_tmpdir, helpers): """ RPC calls must work properly right after synchronous join""" srv = Server( binary_port = 33002, http_port = 8082, ) srv.start( workdir="{}/localhost-{}".format(module_tmpdir, srv.binary_port) ) try: helpers.wait_for(srv.ping_udp, timeout=5) obj = cluster['master'].graphql(""" mutation { join_server( uri: "localhost:33002" instance_uuid: "bbbbbbbb-bbbb-4000-b000-000000000001" replicaset_uuid: "bbbbbbbb-0000-4000-b000-000000000000" roles: ["myrole"] timeout: 5 ) } """) assert 'errors' not in obj, obj['errors'][0]['message'] assert obj['data']['join_server'] == True srv.connect() assert rpc_call(cluster['master'], 'myrole', 'get_state') == \ ('initialized', None) finally: srv.kill()
def test_uninitialized(module_tmpdir, helpers): srv = Server(binary_port=33401, http_port=8401, alias='dummy') srv.start(workdir="{}/localhost-{}".format(module_tmpdir, srv.binary_port), env={'TARANTOOL_AUTH_ENABLED': 'true'}) try: helpers.wait_for(srv.ping_udp, timeout=5) resp = _login(srv, 'admin', 'cluster-cookies-for-the-cluster-monster') print('login successful') assert resp.status_code == 200, resp.content assert 'lsid' in resp.cookies lsid = resp.cookies['lsid'] check_401(srv, cookies={'lsid': None}) check_200(srv, cookies={'lsid': lsid}) finally: srv.kill()
def test_uninitialized(module_tmpdir, helpers): srv = Server(binary_port=33101, http_port=8181, alias='dummy') srv.start(workdir="{}/localhost-{}".format(module_tmpdir, srv.binary_port), ) try: helpers.wait_for(srv.ping_udp, timeout=5) obj = srv.graphql(""" { servers { uri replicaset { roles } } replicasets { status } cluster { self { uri uuid alias } can_bootstrap_vshard vshard_bucket_count } } """) assert 'errors' not in obj, obj['errors'][0]['message'] servers = obj['data']['servers'] assert len(servers) == 1 assert servers[0] == {'uri': 'localhost:33101', 'replicaset': None} replicasets = obj['data']['replicasets'] assert len(replicasets) == 0 assert obj['data']['cluster']['self'] == { 'uri': 'localhost:33101', 'alias': 'dummy', 'uuid': None, } assert obj['data']['cluster']['can_bootstrap_vshard'] == False assert obj['data']['cluster']['vshard_bucket_count'] == 3000 obj = srv.graphql(""" mutation { join_server(uri: "127.0.0.1:33101") } """) assert obj['errors'][0]['message'] == \ 'Invalid attempt to call join_server().' + \ ' This instance isn\'t bootstrapped yet' + \ ' and advertises uri="localhost:33101"' + \ ' while you are joining uri="127.0.0.1:33101".' obj = srv.graphql(""" { cluster { failover } } """) assert 'errors' not in obj, obj['errors'][0]['message'] assert obj['data']['cluster']['failover'] == False obj = srv.graphql(""" mutation { cluster { failover(enabled: false) } } """) assert obj['errors'][0]['message'] == 'Not bootstrapped yet' finally: srv.kill()