Exemplo n.º 1
0
    def test_checks_out_repo(self):
        gs = GitSource('git', DOCKERFILE_GIT)
        assert os.path.exists(os.path.join(gs.path, '.git'))
        assert os.path.basename(gs.path) == 'docker-hello-world'
        assert gs.commit_id is not None
        assert len(gs.commit_id) == 40  # current git hashes are this long

        previous_commit_id = gs.commit_id
        gs.reset('HEAD~2')  # Go back two commits
        assert gs.commit_id is not None
        assert gs.commit_id != previous_commit_id
        assert len(gs.commit_id) == 40  # current git hashes are this long
Exemplo n.º 2
0
    def test_checks_out_repo(self):
        gs = GitSource('git', DOCKERFILE_GIT)
        assert os.path.exists(os.path.join(gs.path, '.git'))
        assert os.path.basename(gs.path) == 'docker-hello-world'
        assert gs.commit_id is not None
        assert len(gs.commit_id) == 40  # current git hashes are this long

        previous_commit_id = gs.commit_id
        gs.reset('HEAD~2')  # Go back two commits
        assert gs.commit_id is not None
        assert gs.commit_id != previous_commit_id
        assert len(gs.commit_id) == 40  # current git hashes are this long
Exemplo n.º 3
0
    def test_checks_out_repo(self, local_fake_repo, add_git_suffix):
        if add_git_suffix:
            repo_url = local_fake_repo + ".git"
            os.rename(local_fake_repo, repo_url)
        else:
            repo_url = local_fake_repo
        gs = GitSource('git', repo_url)
        gs.get()
        assert os.path.exists(os.path.join(gs.path, '.git'))
        assert os.path.basename(gs.path) == 'app-operator'
        assert gs.commit_id is not None
        assert len(gs.commit_id) == 40  # current git hashes are this long

        previous_commit_id = gs.commit_id
        gs.reset('HEAD~2')  # Go back two commits
        assert gs.commit_id is not None
        assert gs.commit_id != previous_commit_id
        assert len(gs.commit_id) == 40  # current git hashes are this long