Commit ae91c723 authored by Micaël Bergeron's avatar Micaël Bergeron

fix some legitimate specs failures

parent 47b9ef3f
......@@ -144,6 +144,7 @@
- cronjob:ldap_all_groups_sync
- cronjob:ldap_sync
- cronjob:update_all_mirrors
- cronjob:pseudonymizer
- geo:geo_scheduler_scheduler
- geo:geo_scheduler_primary_scheduler
......
......@@ -68,7 +68,7 @@ module EE
:slack_app_secret,
:slack_app_verification_token,
:allow_group_owners_to_manage_ldap,
:elt_database_dump_enabled
:pseudonymizer_enabled
]
end
......
......@@ -26,7 +26,7 @@ module Pseudonymizer
end
class Dumper
attr_accessor :config
attr_accessor :config, :output_dir
def initialize(options)
@config = options.config
......@@ -39,7 +39,7 @@ module Pseudonymizer
def tables_to_csv
tables = config["tables"]
FileUtils.mkdir_p(@output_dir) unless File.directory?(@output_dir)
FileUtils.mkdir_p(output_dir) unless File.directory?(output_dir)
new_tables = tables.map do |k, v|
@schema[k] = {}
......@@ -55,7 +55,7 @@ module Pseudonymizer
file_timestamp = filename || "#{prefix}_#{Time.now.to_i}"
file_timestamp = "#{file_timestamp}.#{ext}"
@output_files << file_timestamp
File.join(@output_dir, file_timestamp)
File.join(output_dir, file_timestamp)
end
def schema_to_yml
......
......@@ -3,9 +3,16 @@ require 'spec_helper'
describe Pseudonymizer::Dumper do
let!(:project) { create(:project) }
let(:base_dir) { Dir.mktmpdir }
let(:options) { Pseudonymizer::Options.new() }
let(:options) do
Pseudonymizer::Options.new(config: Gitlab.config.pseudonymizer,
start_at: Time.now.utc)
end
subject(:pseudo) { described_class.new(options) }
before do
allow(options).to receive(:output_dir).and_return(base_dir)
end
after do
FileUtils.rm_rf(base_dir)
end
......@@ -13,7 +20,6 @@ describe Pseudonymizer::Dumper do
# create temp directory in before block
describe 'Pseudo tables' do
it 'outputs project tables to csv' do
pseudo.config["output"]["csv"] = base_dir
pseudo.config["tables"] = {
"projects" => {
"whitelist" => %w(id name path description),
......@@ -21,7 +27,7 @@ describe Pseudonymizer::Dumper do
}
}
expect(pseudo.config["output"]["csv"]).to eq(base_dir)
expect(pseudo.output_dir).to eq(base_dir)
# grab the first table it outputs. There would only be 1.
project_table_file = pseudo.tables_to_csv[0]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment