Beispiel #1
0
 def setUp(self):
     super(TestSwiftConnector, self).setUp()
     self.conf = swift.load_conf(file=BytesIO(config_file %
                                               def_config_file))
     with patch('geventhttpclient.HTTPClient.request',
                fake_auth_request_v1):
         self.conn = swift.SwiftConnector('fakerepo', conf=self.conf)
Beispiel #2
0
def cmd_daemon(args):
    """Entry point for starting a TCP git server."""
    import optparse
    parser = optparse.OptionParser()
    parser.add_option("-l", "--listen_address", dest="listen_address",
                      default="127.0.0.1",
                      help="Binding IP address.")
    parser.add_option("-p", "--port", dest="port", type=int,
                      default=TCP_GIT_PORT,
                      help="Binding TCP port.")
    parser.add_option("-c", "--swift_config", dest="swift_config",
                      default="",
                      help="Path to the configuration file for Swift backend.")
    options, args = parser.parse_args(args)

    try:
        import gevent
        import geventhttpclient
    except ImportError:
        print("gevent and geventhttpclient libraries are mandatory "
              " for use the Swift backend.")
        sys.exit(1)
    import gevent.monkey
    gevent.monkey.patch_socket()
    from dulwich.contrib.swift import load_conf
    from dulwich import log_utils
    logger = log_utils.getLogger(__name__)
    conf = load_conf(options.swift_config)
    backend = SwiftSystemBackend(logger, conf)

    log_utils.default_logging_config()
    server = TCPGitServer(backend, options.listen_address,
                          port=options.port)
    server.serve_forever()
 def setUpClass(cls):
     cls.backend = SwiftSystemBackend()
     cls.port = 9148
     cls.server_address = 'localhost'
     cls.fakerepo = 'fakerepo'
     cls.th_server = DulwichServer(cls.backend, cls.port)
     cls.th_server.run()
     cls.conf = swift.load_conf()
Beispiel #4
0
 def setUp(self):
     super(TestSwiftInfoRefsContainer, self).setUp()
     content = \
         "22effb216e3a82f97da599b8885a6cadb488b4c5\trefs/heads/master\n" + \
         "cca703b0e1399008b53a1a236d6b4584737649e4\trefs/heads/dev"
     self.store = {'fakerepo/info/refs': content}
     self.conf = swift.load_conf(file=BytesIO(config_file %
                                               def_config_file))
     self.fsc = FakeSwiftConnector('fakerepo', conf=self.conf)
     self.object_store = {}
Beispiel #5
0
def cmd_init(args):
    import optparse
    parser = optparse.OptionParser()
    parser.add_option("-c", "--swift_config", dest="swift_config",
                      default="",
                      help="Path to the configuration file for Swift backend.")
    options, args = parser.parse_args(args)

    conf = load_conf(options.swift_config)
    if args == []:
        parser.error("missing repository name")
    repo = args[0]
    scon = SwiftConnector(repo, conf)
    SwiftRepo.init_bare(scon, conf)
Beispiel #6
0
 def setUp(self):
     conf = swift.load_conf(file=StringIO(config_file % def_config_file))
     sos = swift.SwiftObjectStore(FakeSwiftConnector("fakerepo", conf=conf))
     commit_amount = 10
     self.commits = create_commits(length=commit_amount, marker="m")
     data = [(d.type_num, d.as_raw_string()) for d in self.commits]
     f = StringIO()
     fi = StringIO()
     expected = build_pack(f, data, store=sos)
     entries = [(sha, ofs, checksum) for ofs, _, _, sha, checksum in expected]
     self.pack_data = PackData.from_file(file=f, size=None)
     write_pack_index_v2(fi, entries, self.pack_data.calculate_checksum())
     fi.seek(0)
     self.pack_index = load_pack_index_file("", fi)
Beispiel #7
0
 def setUp(self):
     super(TestSwiftRepo, self).setUp()
     self.conf = swift.load_conf(file=BytesIO(config_file %
                                              def_config_file))
Beispiel #8
0
 def setUp(self):
     super(TestSwiftObjectStore, self).setUp()
     self.conf = swift.load_conf(file=BytesIO(config_file %
                                              def_config_file))
     self.fsc = FakeSwiftConnector('fakerepo', conf=self.conf)
Beispiel #9
0
 def setUp(self):
     TestCase.setUp(self)
     conf = swift.load_conf(file=StringIO(config_file % def_config_file))
     fsc = FakeSwiftConnector('fakerepo', conf=conf)
     self.store = swift.SwiftObjectStore(fsc)
Beispiel #10
0
 def setUp(self):
     TestCase.setUp(self)
     conf = swift.load_conf(file=BytesIO(config_file %
                            def_config_file))
     fsc = FakeSwiftConnector('fakerepo', conf=conf)
     self.store = swift.SwiftObjectStore(fsc)
Beispiel #11
0
 def setUp(self):
     super(TestSwiftRepo, self).setUp()
     self.conf = swift.load_conf(file=BytesIO(config_file %
                                               def_config_file))
Beispiel #12
0
 def setUp(self):
     super(TestSwiftObjectStore, self).setUp()
     self.conf = swift.load_conf(file=BytesIO(config_file %
                                               def_config_file))
     self.fsc = FakeSwiftConnector('fakerepo', conf=self.conf)
 def setUp(self):
     super(TestSwiftConnector, self).setUp()
     self.conf = swift.load_conf(file=StringIO(config_file % def_config_file))
     with patch("geventhttpclient.HTTPClient.request", fake_auth_request_v1):
         self.conn = swift.SwiftConnector("fakerepo", conf=self.conf)
Beispiel #14
0
 def open_repository(self, path):
     return swift.SwiftRepo(path, conf=swift.load_conf())
 def open_repository(self, path):
     return swift.SwiftRepo(path, conf=swift.load_conf())
Beispiel #16
0
 def setUp(self):
     super(TestSwiftConnector, self).setUp()
     self.conf = swift.load_conf(file=StringIO(config_file % def_config_file))
     with patch("geventhttpclient.HTTPClient.request", fake_auth_request_v1):
         self.conn = swift.SwiftConnector("fakerepo", conf=self.conf)