Revision 43c4bd72
Added by Marek Hulán over 9 years ago
test/unit/host_observer_test.rb | ||
---|---|---|
class HostObserverTest < ActiveSupport::TestCase
|
||
test "tokens should be removed based on build state" do
|
||
disable_orchestration
|
||
h = FactoryGirl.create(:host, :managed)
|
||
as_admin do
|
||
h = FactoryGirl.create(:host, :managed, :ip => '127.0.0.1')
|
||
Setting[:token_duration] = 60
|
||
assert_difference('Token.count') do
|
||
h.build = true
|
||
... | ... | |
disable_orchestration
|
||
host = as_admin do
|
||
Setting[:token_duration] = 30
|
||
host = Host.create! :name => "foo", :mac => "aabbeeddccff", :ip => "2.3.4.244", :managed => true, :ptable => ptables(:one), :medium => media(:one),
|
||
:build => true, :architecture => architectures(:x86_64), :environment => Environment.first, :puppet_proxy_id => smart_proxies(:one).id,
|
||
:domain => Domain.first, :operatingsystem => operatingsystems(:redhat), :subnet => subnets(:one),
|
||
:root_pass => "xybxa6JUkz63w", :url_options => {:host => 'foreman', :protocol => "http://"},
|
||
:location => taxonomies(:location1), :organization => taxonomies(:organization1)
|
||
FactoryGirl.create :host, :managed,
|
||
:name => "foo",
|
||
:mac => "aabbeeddccff",
|
||
:ip => "2.3.4.244",
|
||
:ptable => ptables(:one),
|
||
:medium => media(:one),
|
||
:build => true,
|
||
:architecture => architectures(:x86_64),
|
||
:environment => Environment.first,
|
||
:puppet_proxy_id => smart_proxies(:one).id,
|
||
:domain => Domain.first,
|
||
:operatingsystem => operatingsystems(:redhat),
|
||
:subnet => subnets(:one),
|
||
:root_pass => "xybxa6JUkz63w",
|
||
:url_options => {:host => 'foreman', :protocol => "http://"},
|
||
:location => taxonomies(:location1), :organization => taxonomies(:organization1)
|
||
end
|
||
|
||
assert host.token.try(:value).present?
|
Also available in: Unified diff
Fixes #7456 - Extract primary interface from host
Contributions from:All host must have at least one primary interface and one provision (can
be the same interface). Primary interface gives host a name so even
unamanaged host have primary interface (we skip validations of other
attributes for unamanged hosts though).
Host still have name attribute which is a cache of primary interface name.
Therefore we can use the host name in SQL queries, as a friendly_id etc.
- realm moved to the primary tab
- fqdn in nics table
- flags in nics table
- checkboxes for provision and primary flags
- modal resize fix
- original fields for primary NIC removed
- skipping validation for new resources
- warnings before switching flags and table update
- host name and primary interface name connected
- host domain name in the page title
- nics on host show page
- clearing modal window on cancel
- fixed domain validation in NIC::Base
- ip suggestion for all interfaces
- flags switchable from the overview table
- use icons instead of text for primary/provision on NICs overview tab
- attempt to fix sending NIC template
- fix fqdn algorithm
- ip addres in the overview table
- fix for class name collision
- better behavior of host name <-> primary name sync
- fix for subnet combobox values
- fix for modal poping up on form submission
- network partial for CRs moved from VM tab to modal
- fix ip suggestion race for ipam=db