mirror of
https://github.com/internetee/registry.git
synced 2025-05-18 10:19:45 +02:00
Test zonefiles
This commit is contained in:
parent
39eb5b9864
commit
81956c23e2
3 changed files with 57 additions and 3 deletions
|
@ -31,6 +31,7 @@ bundle install
|
||||||
|
|
||||||
RAILS_ENV=test bundle exec rake db:all:drop
|
RAILS_ENV=test bundle exec rake db:all:drop
|
||||||
RAILS_ENV=test bundle exec rake db:all:setup
|
RAILS_ENV=test bundle exec rake db:all:setup
|
||||||
|
RAILS_ENV=test bundle exec rake zonefile:replace_procedure
|
||||||
RAILS_ENV=test bundle exec rake assets:precompile
|
RAILS_ENV=test bundle exec rake assets:precompile
|
||||||
|
|
||||||
echo "GIT_LAST_COMMITS"
|
echo "GIT_LAST_COMMITS"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
Fabricator(:domain) do
|
Fabricator(:domain) do
|
||||||
name { sequence(:name) { |i| "fabricate_name#{i}.ee" } }
|
name { sequence(:name) { |i| "domain#{i}.ee" } }
|
||||||
valid_to Date.new(2014, 8, 7)
|
valid_to Date.new(2014, 8, 7)
|
||||||
period 1
|
period 1
|
||||||
period_unit 'y'
|
period_unit 'y'
|
||||||
|
@ -11,5 +11,5 @@ Fabricator(:domain) do
|
||||||
end
|
end
|
||||||
|
|
||||||
Fabricator(:domain_with_dnskeys, from: :domain) do
|
Fabricator(:domain_with_dnskeys, from: :domain) do
|
||||||
dnskeys(count: 1)
|
after_create { |domain| Fabricate(:dnskey, domain: domain) }
|
||||||
end
|
end
|
||||||
|
|
53
spec/models/zonefile_setting_spec.rb
Normal file
53
spec/models/zonefile_setting_spec.rb
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
describe ZonefileSetting do
|
||||||
|
before { create_settings }
|
||||||
|
it 'generates the zonefile' do
|
||||||
|
ZonefileSetting.where({
|
||||||
|
origin: 'ee',
|
||||||
|
ttl: 43200,
|
||||||
|
refresh: 3600,
|
||||||
|
retry: 900,
|
||||||
|
expire: 1209600,
|
||||||
|
minimum_ttl: 3600,
|
||||||
|
email: 'hostmaster.eestiinternet.ee',
|
||||||
|
master_nameserver: 'ns.tld.ee'
|
||||||
|
}).first_or_create!
|
||||||
|
|
||||||
|
ZonefileSetting.where({
|
||||||
|
origin: 'pri.ee',
|
||||||
|
ttl: 43200,
|
||||||
|
refresh: 3600,
|
||||||
|
retry: 900,
|
||||||
|
expire: 1209600,
|
||||||
|
minimum_ttl: 3600,
|
||||||
|
email: 'hostmaster.eestiinternet.ee',
|
||||||
|
master_nameserver: 'ns.tld.ee'
|
||||||
|
}).first_or_create!
|
||||||
|
|
||||||
|
d = Fabricate(:domain_with_dnskeys)
|
||||||
|
d.nameservers << Nameserver.new({
|
||||||
|
hostname: "ns.#{d.name}",
|
||||||
|
ipv4: '123.123.123.123',
|
||||||
|
ipv6: 'FE80:0000:0000:0000:0202:B3FF:FE1E:8329'
|
||||||
|
})
|
||||||
|
|
||||||
|
@zonefile = ActiveRecord::Base.connection.execute(
|
||||||
|
"select generate_zonefile('ee')"
|
||||||
|
)[0]['generate_zonefile']
|
||||||
|
|
||||||
|
@zonefile.should_not be_blank
|
||||||
|
@zonefile.scan(/^#{d.name}/).count.should == 5
|
||||||
|
@zonefile.scan(/ns.#{d.name}/).count.should == 3
|
||||||
|
@zonefile.scan('123.123.123.123').count.should == 1
|
||||||
|
@zonefile.scan('FE80:0000:0000:0000:0202:B3FF:FE1E:8329').count.should == 1
|
||||||
|
|
||||||
|
@zonefile = ActiveRecord::Base.connection.execute(
|
||||||
|
"select generate_zonefile('pri.ee')"
|
||||||
|
)[0]['generate_zonefile']
|
||||||
|
|
||||||
|
@zonefile.should_not be_blank
|
||||||
|
|
||||||
|
@zonefile.scan(/^#{d.name}/).count.should == 0
|
||||||
|
end
|
||||||
|
end
|
Loading…
Add table
Add a link
Reference in a new issue