Skip to content

test failure: tests expect localhost as hostname (spec/models)

Many tests failed because it was expecting localhost and got a different username. These were run from app_root of a natively installed gitlab. In debian, hostname is set using GITLAB_HOST environment variable.

$ sudo -u gitlab -E -H bundle exec rspec spec/models/
Error deleting useless .secret file: Permission denied @ unlink_internal - /usr/share/gitlab/.secret
DEPRECATION WARNING: Sprockets method `register_engine` is deprecated.
Please register a mime type using `register_mime_type` then
use `register_compressor` or `register_transformer`.
https://github.com/rails/sprockets/blob/master/guides/extending_sprockets.md#supporting-all-versions-of-sprockets-in-processors
 (called from block (2 levels) in <class:Railtie> at /usr/lib/ruby/vendor_ruby/sass/rails/railtie.rb:57)
DEPRECATION WARNING: Sprockets method `register_engine` is deprecated.
Please register a mime type using `register_mime_type` then
use `register_compressor` or `register_transformer`.
https://github.com/rails/sprockets/blob/master/guides/extending_sprockets.md#supporting-all-versions-of-sprockets-in-processors
 (called from block (2 levels) in <class:Railtie> at /usr/lib/ruby/vendor_ruby/sass/rails/railtie.rb:58)
.....................................................................................................................F........................................................................................................................................................................................................................................................................................................................................................................................................................................output error : unknown encoding ASCII-8BIT
output error : unknown encoding ASCII-8BIT
output error : unknown encoding ASCII-8BIT
output error : unknown encoding ASCII-8BIT
output error : unknown encoding ASCII-8BIT
output error : unknown encoding ASCII-8BIT
......................................................................................F...............................................................................................................................................................................................................................................................................................................................................................................................F................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................F..................................................................................................................................................................................................................................................................**.....................FF....FF.F.......FF...............................................................................................................................................................................................................................................F.FFFFFFF...F....................................................................................................................F....F....FFF...........................................................................................................................................................................................................................................................................................

Pending: (Failures listed here are expected and do not affect your suite's status)

  1) Project#new_issue_address incoming email enabled returns the address to create a new issue
     # Temporarily skipped with xdescribe
     # ./spec/models/project_spec.rb:259

  2) Project#new_issue_address incoming email disabled returns nil
     # Temporarily skipped with xdescribe
     # ./spec/models/project_spec.rb:272

Failures:

  1) BroadcastMessage.current returns last message if time match
     Failure/Error: expect(BroadcastMessage.current).to eq message

       expected: #<BroadcastMessage id: 10, message: "MyText", starts_at: "2016-09-17 02:46:50", ends_at: "2016-09-19 02:46:50", created_at: "2016-09-18 02:47:45", updated_at: "2016-09-18 02:47:45", color: "#E75E40", font: "#FFFFFF">
            got: nil

       (compared using ==)
     # ./spec/models/broadcast_message_spec.rb:27:in `block (3 levels) in <top (required)>'

  2) ApplicationSetting TokenAuthenticatable generating new token token is not generated yet ensured! token persists new token
     Failure/Error: expect(subject).to eq described_class.current[token_field]

       expected: "ys7fizfkT3XZ-fPwgEYB"
            got: "fXx2tsnkNxyAB7fCdoVg"

       (compared using ==)
     # ./spec/models/concerns/token_authenticatable_spec.rb:45:in `block (5 levels) in <top (required)>'

  3) Key Methods #publishable_keys replaces SSH key comment with simple identifier of username + hostname
     Failure/Error: expect(build(:key, user: user).publishable_key).to include("#{user.name} (localhost)")
       expected "ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIEAiPWx6WM4lhHNedGfBpPJNPpZ7yKu+dnn1SJejgt4596k6YjzGGphH2TUxwKzxcKDKKezwkpfnxPkSMkuEspGRt/aZZ9wa++Oi7Qkr8prgHc4soW6NUlfDzpvZK2H5E7eQaSeP3SAwGmQKUFHCddNaP0L+hM7zhFNzjFvpaMgJw0= Zula Hansen (nishumbha)" to include "Zula Hansen (localhost)"
     # ./spec/models/key_spec.rb:25:in `block (4 levels) in <top (required)>'

  4) GitlabIssueTrackerService project and issue urls with absolute urls gives the correct path
     Failure/Error: expect(@service.project_url).to eq("http://localhost/gitlab/root/#{project.path_with_namespace}/issues")

       expected: "http://localhost/gitlab/root/namespace1383/gitlabhq/issues"
            got: "http://nishumbha/gitlab/root/namespace1383/gitlabhq/issues"

       (compared using ==)
     # ./spec/models/project_services/gitlab_issue_tracker_service_spec.rb:58:in `block (4 levels) in <top (required)>'

  5) Project#external_issue_tracker returns nil and does not query services when there is no external issue tracker
     Failure/Error: update_column(:has_external_issue_tracker, services.external_issue_trackers.any?)

       (#<Project:0x00000016ff6340>).services(no args)
           expected: 0 times with any arguments
           received: 1 time
     # ./app/models/project.rb:680:in `cache_has_external_issue_tracker'
     # ./app/models/project.rb:667:in `external_issue_tracker'
     # ./spec/models/project_spec.rb:473:in `block (3 levels) in <top (required)>'

  6) Project#external_issue_tracker retrieves external_issue_tracker querying services and cache it when there is external issue tracker
     Failure/Error: @external_issue_tracker = services.external_issue_trackers.first

       (#<Project:0x0000000cb130d0>).services(no args)
           expected: 1 time with any arguments
           received: 2 times
     # ./app/models/project.rb:673:in `external_issue_tracker'
     # ./spec/models/project_spec.rb:483:in `block (4 levels) in <top (required)>'
     # ./spec/models/project_spec.rb:483:in `times'
     # ./spec/models/project_spec.rb:483:in `block (3 levels) in <top (required)>'

  7) Project#external_wiki with an active external wiki sets :has_external_wiki as false if an external wiki service is destroyed later
     Failure/Error: expect(project.has_external_wiki).to be(false)

       expected false
            got true
     # ./spec/models/project_spec.rb:527:in `block (4 levels) in <top (required)>'

  8) Project#external_wiki with an inactive external wiki sets :has_external_wiki as false
     Failure/Error: expect(project.has_external_wiki).to be(false)

       expected false
            got nil
     # ./spec/models/project_spec.rb:537:in `block (4 levels) in <top (required)>'

  9) Project#external_wiki with no external wiki sets :has_external_wiki as true if an external wiki service is created later
     Failure/Error: expect(project.has_external_wiki).to be(true)

       expected true
            got false
     # ./spec/models/project_spec.rb:555:in `block (4 levels) in <top (required)>'

  10) Project#avatar_url When avatar file is uploaded should eq "http://localhost/uploads/project/avatar/1521/uploads/avatar.png"
      Failure/Error: it { should eq "http://localhost#{avatar_path}" }

        expected: "http://localhost/uploads/project/avatar/1521/uploads/avatar.png"
             got: "http://nishumbha/uploads/project/avatar/1521/uploads/avatar.png"

        (compared using ==)
      # ./spec/models/project_spec.rb:666:in `block (4 levels) in <top (required)>'

  11) Project#avatar_url When avatar file in git should eq "http://localhost/namespace1546/gitlabhq/avatar"
      Failure/Error: it { should eq "http://localhost#{avatar_path}" }

        expected: "http://localhost/namespace1546/gitlabhq/avatar"
             got: "http://nishumbha/namespace1546/gitlabhq/avatar"

        (compared using ==)
      # ./spec/models/project_spec.rb:678:in `block (4 levels) in <top (required)>'

  12) Repository#license_blob looks in the root_ref only
      Failure/Error: repository.commit_file(user, 'LICENSE', Licensee::License.new('mit').content, 'Add LICENSE', 'markdown', false)

      Licensee::InvalidLicense:
        'mit' is not a valid license key
      # ./spec/models/repository_spec.rb:270:in `block (3 levels) in <top (required)>'

  13) Repository#license_blob detects 'LICENSE'
      Failure/Error: repository.commit_file(user, filename, Licensee::License.new('mit').content, "Add #{filename}", 'master', false)

      Licensee::InvalidLicense:
        'mit' is not a valid license key
      # ./spec/models/repository_spec.rb:283:in `block (4 levels) in <top (required)>'

  14) Repository#license_blob detects 'LICENCE'
      Failure/Error: repository.commit_file(user, filename, Licensee::License.new('mit').content, "Add #{filename}", 'master', false)

      Licensee::InvalidLicense:
        'mit' is not a valid license key
      # ./spec/models/repository_spec.rb:283:in `block (4 levels) in <top (required)>'

  15) Repository#license_blob detects 'LiCensE'
      Failure/Error: repository.commit_file(user, filename, Licensee::License.new('mit').content, "Add #{filename}", 'master', false)

      Licensee::InvalidLicense:
        'mit' is not a valid license key
      # ./spec/models/repository_spec.rb:283:in `block (4 levels) in <top (required)>'

  16) Repository#license_blob detects 'LICENSE.md'
      Failure/Error: repository.commit_file(user, filename, Licensee::License.new('mit').content, "Add #{filename}", 'master', false)

      Licensee::InvalidLicense:
        'mit' is not a valid license key
      # ./spec/models/repository_spec.rb:283:in `block (4 levels) in <top (required)>'

  17) Repository#license_blob detects 'LICENSE.foo'
      Failure/Error: repository.commit_file(user, filename, Licensee::License.new('mit').content, "Add #{filename}", 'master', false)

      Licensee::InvalidLicense:
        'mit' is not a valid license key
      # ./spec/models/repository_spec.rb:283:in `block (4 levels) in <top (required)>'

  18) Repository#license_blob detects 'COPYING'
      Failure/Error: repository.commit_file(user, filename, Licensee::License.new('mit').content, "Add #{filename}", 'master', false)

      Licensee::InvalidLicense:
        'mit' is not a valid license key
      # ./spec/models/repository_spec.rb:283:in `block (4 levels) in <top (required)>'

  19) Repository#license_blob detects 'COPYING.md'
      Failure/Error: repository.commit_file(user, filename, Licensee::License.new('mit').content, "Add #{filename}", 'master', false)

      Licensee::InvalidLicense:
        'mit' is not a valid license key
      # ./spec/models/repository_spec.rb:283:in `block (4 levels) in <top (required)>'

  20) Repository#license_key returns the license key
      Failure/Error: repository.commit_file(user, 'LICENSE', Licensee::License.new('mit').content, 'Add LICENSE', 'master', false)

      Licensee::InvalidLicense:
        'mit' is not a valid license key
      # ./spec/models/repository_spec.rb:316:in `block (3 levels) in <top (required)>'

  21) Service {property}_changed? returns false when the property has been assigned a new value then saved
      Failure/Error: expect(service.bamboo_url_changed?).to be_falsy

        expected: falsey value
             got: true
      # ./spec/models/service_spec.rb:122:in `block (3 levels) in <top (required)>'

  22) Service {property}_touched? returns false when the property has been assigned a new value then saved
      Failure/Error: expect(service.bamboo_url_changed?).to be_falsy

        expected: falsey value
             got: true
      # ./spec/models/service_spec.rb:162:in `block (3 levels) in <top (required)>'

  23) Service {property}_was returns nil when the property has been assigned a new value then saved
      Failure/Error: expect(service.bamboo_url_was).to be_nil

        expected: nil
             got: "http://gitlab.com"
      # ./spec/models/service_spec.rb:202:in `block (3 levels) in <top (required)>'

  24) Service callbacks on create updates the has_external_issue_tracker boolean
      Failure/Error:
        expect do
          service.save!
        end.to change { service.project.has_external_issue_tracker }.from(nil).to(true)

        expected result to have changed from nil to true, but did not change
      # ./spec/models/service_spec.rb:222:in `block (4 levels) in <top (required)>'

  25) Service callbacks on update updates the has_external_issue_tracker boolean
      Failure/Error:
        expect do
          service.update_attributes(active: false)
        end.to change { service.project.has_external_issue_tracker }.from(true).to(false)

        expected result to have initially been true, but was nil
      # ./spec/models/service_spec.rb:232:in `block (4 levels) in <top (required)>'

Finished in 33 minutes 43 seconds (files took 9.76 seconds to load)
2538 examples, 25 failures, 2 pending

Failed examples:

rspec ./spec/models/broadcast_message_spec.rb:24 # BroadcastMessage.current returns last message if time match
rspec ./spec/models/concerns/token_authenticatable_spec.rb:44 # ApplicationSetting TokenAuthenticatable generating new token token is not generated yet ensured! token persists new token
rspec ./spec/models/key_spec.rb:24 # Key Methods #publishable_keys replaces SSH key comment with simple identifier of username + hostname
rspec ./spec/models/project_services/gitlab_issue_tracker_service_spec.rb:57 # GitlabIssueTrackerService project and issue urls with absolute urls gives the correct path
rspec ./spec/models/project_spec.rb:467 # Project#external_issue_tracker returns nil and does not query services when there is no external issue tracker
rspec ./spec/models/project_spec.rb:476 # Project#external_issue_tracker retrieves external_issue_tracker querying services and cache it when there is external issue tracker
rspec ./spec/models/project_spec.rb:522 # Project#external_wiki with an active external wiki sets :has_external_wiki as false if an external wiki service is destroyed later
rspec ./spec/models/project_spec.rb:536 # Project#external_wiki with an inactive external wiki sets :has_external_wiki as false
rspec ./spec/models/project_spec.rb:550 # Project#external_wiki with no external wiki sets :has_external_wiki as true if an external wiki service is created later
rspec ./spec/models/project_spec.rb:666 # Project#avatar_url When avatar file is uploaded should eq "http://localhost/uploads/project/avatar/1521/uploads/avatar.png"
rspec ./spec/models/project_spec.rb:678 # Project#avatar_url When avatar file in git should eq "http://localhost/namespace1546/gitlabhq/avatar"
rspec ./spec/models/repository_spec.rb:268 # Repository#license_blob looks in the root_ref only
rspec ./spec/models/repository_spec.rb[1:13:4] # Repository#license_blob detects 'LICENSE'
rspec ./spec/models/repository_spec.rb[1:13:5] # Repository#license_blob detects 'LICENCE'
rspec ./spec/models/repository_spec.rb[1:13:6] # Repository#license_blob detects 'LiCensE'
rspec ./spec/models/repository_spec.rb[1:13:7] # Repository#license_blob detects 'LICENSE.md'
rspec ./spec/models/repository_spec.rb[1:13:8] # Repository#license_blob detects 'LICENSE.foo'
rspec ./spec/models/repository_spec.rb[1:13:9] # Repository#license_blob detects 'COPYING'
rspec ./spec/models/repository_spec.rb[1:13:10] # Repository#license_blob detects 'COPYING.md'
rspec ./spec/models/repository_spec.rb:315 # Repository#license_key returns the license key
rspec ./spec/models/service_spec.rb:119 # Service {property}_changed? returns false when the property has been assigned a new value then saved
rspec ./spec/models/service_spec.rb:159 # Service {property}_touched? returns false when the property has been assigned a new value then saved
rspec ./spec/models/service_spec.rb:199 # Service {property}_was returns nil when the property has been assigned a new value then saved
rspec ./spec/models/service_spec.rb:221 # Service callbacks on create updates the has_external_issue_tracker boolean
rspec ./spec/models/service_spec.rb:229 # Service callbacks on update updates the has_external_issue_tracker boolean

pravi@nishumbha:/usr/share/gitlab$