Skip to content
Browse files

Merge pull request #1417 from brightbox/add_dns_name

[Brightbox] Adds #dns_name to server
  • Loading branch information...
2 parents 3c6bf2d + aa66911 commit 2e83766a55f0bb3ed4255fecfd152b26c1dbf8cd @tokengeek tokengeek committed
Showing with 29 additions and 0 deletions.
  1. +8 −0 lib/fog/brightbox/models/compute/server.rb
  2. +21 −0 tests/brightbox/models/compute/server_tests.rb
View
8 lib/fog/brightbox/models/compute/server.rb
@@ -129,6 +129,14 @@ def image
connection.images.get(image_id)
end
+ # Returns the public DNS name of the server
+ #
+ # @return [String]
+ #
+ def dns_name
+ ["public", fqdn].join(".")
+ end
+
def private_ip_address
unless interfaces.empty?
interfaces.first["ipv4_address"]
View
21 tests/brightbox/models/compute/server_tests.rb
@@ -0,0 +1,21 @@
+Shindo.tests("Fog::Compute[:brightbox] | Server model", ["brightbox"]) do
+
+ pending if Fog.mocking?
+
+ tests("success") do
+
+ unless Fog.mocking?
+ @server = Brightbox::Compute::TestSupport.get_test_server
+ server_id = @server.id
+ end
+
+ tests("#dns_name") do
+ pending if Fog.mocking?
+ returns("public.#{@server.fqdn}") { @server.dns_name }
+ end
+
+ unless Fog.mocking?
+ @server.destroy
+ end
+ end
+end

0 comments on commit 2e83766

Please sign in to comment.
Something went wrong with that request. Please try again.