Sha256: 8174b0d1d6135042bfaa8d811775e9e1876e008743208823b6ec38ddc52ccd3a

Contents?: true

Size: 1.45 KB

Versions: 44

Compression:

Stored size: 1.45 KB

Contents

require "spec_helper"
require "stringio"
require "gitlab_exporter/cli"

context "An invalid repository" do
  describe GitLab::Exporter::Git do
    it "fails with an invalid repository" do
      repo = Dir.mktmpdir
      Dir.rmdir(repo)
      expect { GitLab::Exporter::Git.new(repo) }.to raise_error(/Repository #{repo} does not exists/)
    end
  end
end

context "With valid pair of repositories" do
  let(:repos) { GitRepoBuilder.new }

  after do
    repos.cleanup
  end

  describe GitLab::Exporter::Git do
    it "builds with a repo folder" do
      expect(GitLab::Exporter::Git.new(repos.cloned_repo)).to be
    end

    it "pulls correctly" do
      expect(GitLab::Exporter::Git.new(repos.cloned_repo).pull.time).to satisfy { |v| v >= 0 }
    end

    it "pushes correctly" do
      expect(GitLab::Exporter::Git.new(repos.cloned_repo).push.time).to satisfy { |v| v >= 0 }
    end
  end

  describe GitLab::Exporter::GitProber do
    let(:options) { { source: repos.cloned_repo, labels: {} } }
    let(:output) { StringIO.new }

    it "probes and monitors a pull" do
      prober = GitLab::Exporter::GitProber.new(**options)
      prober.probe_pull.write_to(output)
      expect(output.string).to match(/git_pull_time_milliseconds \d+ \d+/)
    end

    it "probes and monitors a push" do
      prober = GitLab::Exporter::GitProber.new(**options)
      prober.probe_push.write_to(output)
      expect(output.string).to match(/git_push_time_milliseconds \d+ \d+/)
    end
  end
end

Version data entries

44 entries across 44 versions & 1 rubygems

Version Path
gitlab-exporter-11.19.0 spec/git_spec.rb
gitlab-exporter-11.18.2 spec/git_spec.rb
gitlab-exporter-11.18.1 spec/git_spec.rb
gitlab-exporter-11.18.0 spec/git_spec.rb
gitlab-exporter-11.17.1 spec/git_spec.rb
gitlab-exporter-11.17.0 spec/git_spec.rb
gitlab-exporter-11.16.0 spec/git_spec.rb
gitlab-exporter-11.15.2 spec/git_spec.rb
gitlab-exporter-11.15.1 spec/git_spec.rb
gitlab-exporter-11.15.0 spec/git_spec.rb
gitlab-exporter-11.14.0 spec/git_spec.rb
gitlab-exporter-11.13.1 spec/git_spec.rb
gitlab-exporter-11.13.0 spec/git_spec.rb
gitlab-exporter-11.12.0 spec/git_spec.rb
gitlab-exporter-11.11.0 spec/git_spec.rb
gitlab-exporter-11.10.0 spec/git_spec.rb
gitlab-exporter-11.9.0 spec/git_spec.rb
gitlab-exporter-11.8.0 spec/git_spec.rb
gitlab-exporter-11.7.0 spec/git_spec.rb
gitlab-exporter-11.6.0 spec/git_spec.rb