def make(self, *args, **kw):
        if not self._config.mock_enabled:
            return None

        if self._info:
            return self._info

        bspec_dfl = BucketSpec('default', 'couchbase')
        bspec_sasl = BucketSpec('default_sasl', 'couchbase', 'secret')
        mock = CouchbaseMock([bspec_dfl, bspec_sasl],
                             self._config.mockpath,
                             self._config.mockurl,
                             replicas=2,
                             nodes=4)
        mock.start()

        info = ClusterInformation()
        info.bucket_prefix = "default"
        info.bucket_password = "******"
        info.port = mock.rest_port
        info.host = "127.0.0.1"
        info.admin_username = "******"
        info.admin_password = "******"
        info.extra_buckets = True
        info.mock = mock
        self._info = info
        return info
Exemple #2
0
    def make(self, *args, **kw):
        if not self._config.mock_enabled:
            return None

        if self._info:
            return self._info

        if self._failed:
            raise Exception('Not invoking failed mock!')

        bspec_dfl = BucketSpec('default', 'couchbase')
        mock = CouchbaseMock([bspec_dfl],
                             self._config.mockpath,
                             self._config.mockurl,
                             replicas=2,
                             nodes=4)

        try:
            mock.start()
        except:
            self._failed = True
            raise

        info = ClusterInformation()
        info.bucket_name = "default"
        info.port = mock.rest_port
        info.host = "127.0.0.1"
        info.admin_username = "******"
        info.admin_password = "******"
        info.mock = mock
        self._info = info
        return info
    def _setup_mock(self, mockpath, mockurl):

        bspec_dfl = BucketSpec('default', 'couchbase')
        bspec_sasl = BucketSpec('default_sasl', 'couchbase', 'secret')

        self.mock = CouchbaseMock([bspec_dfl, bspec_sasl],
                                  mockpath,
                                  mockurl,
                                  replicas=2,
                                  nodes=4)
        self.mock.start()
        self.bucket_prefix = "default"
        self.bucket_password = "******"
        self.port = self.mock.rest_port
        self.host = "127.0.0.1"
        self.username = "******"
        self.password = "******"
        self.extra_buckets = True