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-15.0.0 spec/git_spec.rb
gitlab-exporter-14.5.0 spec/git_spec.rb
gitlab-exporter-14.4.0 spec/git_spec.rb
gitlab-exporter-14.3.0 spec/git_spec.rb
gitlab-exporter-14.2.0 spec/git_spec.rb
gitlab-exporter-14.1.0 spec/git_spec.rb
gitlab-exporter-14.0.0 spec/git_spec.rb
gitlab-exporter-13.5.0 spec/git_spec.rb
gitlab-exporter-13.4.1 spec/git_spec.rb
gitlab-exporter-13.4.0 spec/git_spec.rb
gitlab-exporter-13.3.1 spec/git_spec.rb
gitlab-exporter-13.3.0 spec/git_spec.rb
gitlab-exporter-13.2.0 spec/git_spec.rb
gitlab-exporter-13.1.0 spec/git_spec.rb
gitlab-exporter-13.0.3 spec/git_spec.rb
gitlab-exporter-13.0.0 spec/git_spec.rb
gitlab-exporter-12.1.1 spec/git_spec.rb
gitlab-exporter-12.1.0 spec/git_spec.rb
gitlab-exporter-12.0.1 spec/git_spec.rb
gitlab-exporter-12.0.0 spec/git_spec.rb