dosire / gitlab-vagrant-vm

Vagrant VM for GITLAB Developer.
1 stars 0 forks source link

Initial run of Vagrant box #1

Closed maxlazio closed 12 years ago

maxlazio commented 12 years ago

Continued from https://github.com/dosire/gitlabhq/issues/55

maxlazio commented 12 years ago

The order of commands from README.md doesn't make any sense. Working with this:

gem install bundler
git clone https://github.com/gitlabhq/gitlab-vagrant-vm
cd gitlab-vagrant-vm
bundle install
librarian-chef install

Nothing happens after this librarian-chef install ? => Thats because on Vagrant install from the .deb file I needed to add a proper path. Easier to install vagrant via gem.

gem install vagrant

maxlazio commented 12 years ago
vagrant up

The host class is reporting that NFS is not supported by this host,
or `nfsd` may not be installed. Please verify that `nfsd` is installed
on your machine, and retry.

Solved with

sudo apt-get install nfs-common

Vagrant is now provisioning a box.

maxlazio commented 12 years ago
[vagrant] Preparing to edit /etc/exports. Administrator privileges will be required...
sudo: /etc/init.d/nfs-kernel-server: command not found

****

Mounting NFS shared folders failed. This is most often caused by the NFS
client software not being installed on the guest machine. Please verify
that the NFS client software is properly installed, and consult any resources
specific to the linux distro you're using for more information on how to
do this.
maxlazio commented 12 years ago

vagrant ssh sudo apt-get install nfs-kernel-server vagrant halt vagrant up

Error persists.

maxlazio commented 12 years ago

Looks like this is a known problem with vagrant: https://github.com/mitchellh/vagrant/issues/1149 This also didn't help: http://stackoverflow.com/questions/9697976/nfs-fails-after-packaging-a-vagrant-box "Fixed" by setting :nfs => false : https://github.com/gitlabhq/gitlabhq/issues/1498#issuecomment-9060044

maxlazio commented 12 years ago

Setting up vagrant box is in a branch: vagrant_vm_setup https://github.com/dosire/gitlab-vagrant-vm/tree/vagrant_vm_setup

b3592a9cf2b75ae954e03b273235ee3625de45c1

maxlazio commented 12 years ago

When I run vagrant up I get the following notification:

[default] Importing base box 'precise32'...
[default] The guest additions on this VM do not match the install version of
VirtualBox! This may cause things such as forwarded ports, shared
folders, and more to not work properly. If any of those things fail on
this machine, please update the guest additions and repackage the
box.

Guest Additions Version: 4.2.0
VirtualBox Version: 4.1.16

Maybe upgrade virtual box to the newest version?

dosire commented 12 years ago

When done run bundle exec rake gitlab:test

dosire commented 12 years ago

Seems work is being done on a continuous integration app https://twitter.com/dzaporozhets/status/255985298884919296/photo/1/large

dosire commented 12 years ago

Sytse after a clean install without any errors:

Error summary:
  Failures (4)
    Project Browse commits :: I browse commit from list :: Then I see commit info
    Project Browse commits :: I compare refs :: Then I see compared refs
    Project Browse files :: I browse file content :: Then I should see it content
    Project Browse files :: I browse raw file :: Then I should see raw file content

Steps Summary: (624) Successful, (0) Undefined, (0) Pending, (4) Failed, (0) Error
dosire commented 12 years ago
  1. Run just a failing test with one command
  2. Replicate that test (passing) on 2.9.1 git checkout v2.9.1 don't forget to bundle install
  3. Start git bisect http://www.kernel.org/pub/software/scm/git/docs/git-bisect.html
  4. Send a PR for the updated readme
dosire commented 12 years ago

git checkout v2.9.1 => all green (397) Successful, (0) Undefined, (0) Pending, (0) Failed, (0) Error on my vagrant

maxlazio commented 12 years ago

Confirming that on v2.9.1 all spinach and rspec tests are green.

maxlazio commented 12 years ago

Tests that are failing on master branch:

Failures (3)
   Project Browse commits :: I browse commit from list :: Then I see commit info
   Project Browse commits :: I compare refs :: Then I see compared refs
   Project Browse files :: I browse raw file :: Then I should see raw file content

When running single tests that are failures:

Added @bug-1 line 13 of feature/project/source/commits.feature and ran: spinach --tags @bug-1

  Scenario: I browse commit from list
  ✔  Given I sign in as a user        # features/steps/shared/authentication.rb:7
  ✔  And I own a project              # features/steps/shared/project.rb:5
  ✔  And I visit my project's commits page# features/steps/shared/paths.rb:100
  ✔  Given I click on commit link     # features/steps/project/project_browse_commits.rb:25
  ✔  Then I see commit info           # features/steps/project/project_browse_commits.rb:29

  Scenario: I compare refs
   ✔  Given I sign in as a user                 # features/steps/shared/authentication.rb:7
   ✔  And I own a project                       # features/steps/shared/project.rb:5
   ✔  And I visit my project's commits page     # features/steps/shared/paths.rb:100
   ✔  Given I visit compare refs page           # features/steps/shared/paths.rb:145
   ✔  And I fill compare fields with refs       # features/steps/project/project_browse_commits.rb:34
   ✔  Then I see compared refs                  # features/steps/project/project_browse_commits.rb:40

Added @bug-1 to line 17 of feature/project/source/browse_files.feature and ran: spinach --tags @bug-1

   Scenario: I browse raw file
   ✔  Given I sign in as a user               # features/steps/shared/authentication.rb:7
   ✔  And I own project "Shop"                # features/steps/shared/project.rb:11
   ✔  Given I visit project source page       # features/steps/shared/paths.rb:157
   ✔  Given I visit blob file from repo       # features/steps/shared/paths.rb:161
   ✔  And I click link "raw"                  # features/steps/project/project_browse_files.rb:27
   ✔  Then I should see raw file content      # features/steps/project/project_browse_files.rb:31

They pass individually.

maxlazio commented 12 years ago

Running bisect from v2.9.1 to master yielded the following:

  git bisect log
  git bisect start
  # bad: [dda852a0d5c9e684b82cf20380d2b26da1798ecb] Merge pull request #1629 from riyad/show-notes- indicator-for-commits-and-merge-requests
  git bisect bad dda852a0d5c9e684b82cf20380d2b26da1798ecb
  # good: [a6f58b9c435e1680f102ae68a8aedea981a52486] Up to v2.9.1
  git bisect good a6f58b9c435e1680f102ae68a8aedea981a52486
  # bad: [9cabe04368024f44881e4269a008156f1629ab86] tests for: Profile -> History
  git bisect bad 9cabe04368024f44881e4269a008156f1629ab86
  # bad: [c058e3903e01b950d19fe8ce86702f24083c8395] Finalize new routes
  git bisect bad c058e3903e01b950d19fe8ce86702f24083c8395
  # good: [0261b0c64c9df0a1a6834fa4f31395989244c2a9] Project activity inifinite scroll paging
  git bisect good 0261b0c64c9df0a1a6834fa4f31395989244c2a9
  # bad: [79a02df92e18137787371468be5c8897ad2f97b0] Update usages of tree_file_project_ref_path to   project_tree_path
  git bisect bad 79a02df92e18137787371468be5c8897ad2f97b0
  # good: [bde5088525512643434ab88b491c0ba9ad6e248b] Add routing specs for new routes
  git bisect good bde5088525512643434ab88b491c0ba9ad6e248b
  # bad: [6ddb35bd5e27829609e40b8dd87313a01fb6f293] Move tree-related views from refs to trees
  git bisect bad 6ddb35bd5e27829609e40b8dd87313a01fb6f293
  # good: [b389247c029b21f5e85abb5896d2cf22230c9cb1] Use Commit#show instead of Commits#show to view a single commit
  git bisect good b389247c029b21f5e85abb5896d2cf22230c9cb1
  # good: [567767bcf2af2c330c46fde820101fcf847e852f] Add ref_extractor helper module for upcoming controllers
  git bisect good 567767bcf2af2c330c46fde820101fcf847e852f
maxlazio commented 12 years ago

Bisect final output:

 git bisect good
 6ddb35bd5e27829609e40b8dd87313a01fb6f293 is the first bad commit
 commit 6ddb35bd5e27829609e40b8dd87313a01fb6f293
 Author: Robert Speicher <rspeicher@gmail.com>
 Date:   Mon Sep 17 10:57:13 2012 -0400

  Move tree-related views from refs to trees

  :040000 040000 4b58c6f9d92d475de1eaf056340edd64ae7047e3 8f3fa0e37c587e0c85e63e5bccfe682a9ec09f7f M    app
dosire commented 12 years ago

https://github.com/dosire/gitlabhq/commit/6ddb35bd5e27829609e40b8dd87313a01fb6f293

dosire commented 12 years ago

Write to mailing list, consider mentioning:

dosire commented 12 years ago

Written to the mailinglist, other people have the same problems: https://groups.google.com/forum/?fromgroups=#!topic/gitlabhq/xspT4oEVoIY

dosire commented 12 years ago

@maxlazio Maybe you can test which part of the bisected commit causes the problems?

maxlazio commented 12 years ago

Started with:

    git checkout 6ddb35bd5e27829609e40b8dd87313a01fb6f293

To make sure that this commit is to blame I listed the log and checked out one previous commit:

    git checkout 567767bcf2af2c330c46fde820101fcf847e852f

Running the tests there. => Spinach tests are passing but rspec tests are failing(not focusing on that right now).

maxlazio commented 12 years ago

Renaming back all files to their original names before 6ddb35bd5e27829609e40b8dd87313a01fb6f293 made no change. Removing the new file created in that commit also made no change. The tests are still failing. Checking out the previous commit again produced green tests.

maxlazio commented 12 years ago

Removed all changes in 6ddb35bd5e27829609e40b8dd87313a01fb6f293. => Tests fail again.

Untracked files are not included in the diff until they are add to commit either with git add . or git add -N . ( http://stackoverflow.com/questions/855767/can-i-use-git-diff-on-untracked-files)

After this the diff showed no difference between the two commits and the tests are passing.

maxlazio commented 12 years ago

Started from the previous commit(567767bcf2af2c330c46fde820101fcf847e852f) state where everything is working. Then move files and rename them like in the failing commit ( 6ddb35bd5e27829609e40b8dd87313a01fb6f293 ).

Renamed tree.js.haml and tree.html.haml to show.js.haml/show.html.haml and moved them both to app/views/tree/, diff between the 2 commits is shown in this gist: https://gist.github.com/b66f8999843dec4e971d and the test are failing again.

app/views/refs/tree.js.haml -> app/views/tree/show.js.haml, tests pass. app/views/refs/tree.html.haml -> app/views/tree/show.html.haml, test fail.

=> show.html.haml is the culprit.

maxlazio commented 12 years ago

Commented out tree partial call: #tree-holder= render partial: "tree", locals: {repo: @repo, commit: @commit, tree: @tree} => test fail

Commented out everything but the partial call => Tests fail.

Now moved the tree partial to the app/view/tree and uncommented the line in show.html.haml => tests fail Since there is nothing else in show.html.haml file started on _tree.html.haml

In _tree.html.haml commented out
= render partial: "refs/tree_file", locals: { name: tree.name, content: tree.data, file: tree } (line 13) => Tests fail Commenting out: render "head" made no difference, tests are passing.

maxlazio commented 12 years ago

Actually if all files are the same and show.html.haml is moved to the refs dir, doesn't that show that it is nothing wrong with the files themselves but the way they are called?

Starting from the things we know:

  1. all files are in app/views/refs
  2. show.html.haml is tree.html.haml

Try going back from the smallest file possible and comment things out of that file.

_submodule_item.html.haml file: commented out everything => tests pass.

_tree_commit.html.haml
commented out everything => tests pass.

maxlazio commented 12 years ago

_tree_item.html.haml commented out everything =>

  Project Browse files :: I browse file content :: Given I click on "Gemfile" file in repo
  Project Browse git repo :: I blame file :: Given I click on "Gemfile" file in repo

leave in:

maxlazio commented 12 years ago

_tree_file.html.haml

Cannot comment out everything because tests fail from missing links.

Comment out:

name.force_encoding('utf-8') (line 5) => Tests pass. markdown(file.data) (line 15) => Tests pass. raw GitHub::Markup.render(name, file.data) (line 18) => Tests pass. raw file.colorize(options: { linenos: 'True'})

   Project Browse files :: I browse file content :: Then I should see it content
maxlazio commented 12 years ago

_tree.html.haml

Comment out:

@project.name(line 5) => Tests pass.

render partial: "refs/tree_file", locals: { name: tree.name, content: tree.data, file: tree } (line 13) => Test fail because of the missing links

Project Browse files :: I browse raw file :: And I click link "raw"
Project Browse git repo :: I blame file :: And I click blame button

content.name (line 44) => Tests pass. markdown(content.data) (line 48) => Tests pass. raw GitHub::Markup.render(content.name, content.data) => Tests pass. commented out the javascript => Tests pass.

maxlazio commented 12 years ago

Running all tests first => Tests fail. Running only commits.feature => Tests pass. Running only branches.feature => Tests pass. Running all tests after => Tests fail =>

 Project Browse files :: I browse files from master branch :: Given I visit project source page
 Project Browse files :: I browse files for specific ref :: Given I visit project source page
 Project Browse files :: I browse file content :: Given I visit project source page
 Project Browse files :: I browse raw file :: Given I visit project source page
 Project Browse git repo :: I blame file :: Given I visit project source page
maxlazio commented 12 years ago

Running tests on last know good commit( 567767bcf2af2c330c46fde820101fcf847e852f ) after the tests failed => Tests pass.

maxlazio commented 12 years ago

Copied the app/views/tree/show.html.haml file to app/views/refs/tree.html.haml , test fail with:

https://gist.github.com/44a04040d1b03f546c9c

In feature/project/source/browse_file.feature on line 1 add: @browse, save the changes. Run the tests with

spinach --tags @browse

Now they fail even when I run only one feature.

tree.html.haml shouldn't be called at all since on the 6ddb35bd5e27829609e40b8dd87313a01fb6f293 it doesn't exist anymore.

dosire commented 12 years ago

6 comments in 2 hours, nice :zap:

maxlazio commented 12 years ago

Commented out everything in the tree.html.haml file. => The tests are failing with: https://gist.github.com/960cf68c642742c98299

Start raising inside of the file.

maxlazio commented 12 years ago
    = raise "#{ controller.controller_name}".inspect

and the answer is

    "refs"

and the action that calls this view is "tree".

maxlazio commented 12 years ago

Added render 'tree/show' to https://github.com/gitlabhq/gitlabhq/blob/6ddb35bd5e27829609e40b8dd87313a01fb6f293/app/controllers/refs_controller.rb#L47

and the raise is not being triggered anymore.

maxlazio commented 12 years ago

Tests are still failing but now in show.html.haml in tree.

maxlazio commented 12 years ago

In show.html.haml partials are still calling the old path.

How is it possible that the tests were passing with this?

Why were only we affected with this?

Fixed that and now I get a green feature.

Run all the tests to see if this makes any difference. => All tests are now passing(!?)

https://github.com/dosire/gitlabhq/commit/d04e004bca617a3868cbb2562d4d4f09addcd365

maxlazio commented 12 years ago

Go to master, pull. => Done. Run all tests. => All tests failing

  Mysql2::Error: Unknown column 'group_id' in 'field list': SELECT group_id FROM `projects` INNER JOIN `users_projects` ON `projects`.`id` = `users_projects`.`project_id` WHERE `users_projects`.`user_id` = 1

Clean the tmp and seed again. => For RAILS_ENV=test makes no change.

If they fail again try to fix the way it was fixed in HEAD state. Run tests again.

dosire commented 12 years ago

Travis tests https://travis-ci.org/#!/gitlabhq/gitlabhq/

maxlazio commented 12 years ago

6ddb35bd5e27829609e40b8dd87313a01fb6f293

https://github.com/gitlabhq/gitlabhq/blob/6ddb35bd5e27829609e40b8dd87313a01fb6f293

https://github.com/gitlabhq/gitlabhq/pull/1568

dosire commented 12 years ago

Build of last commit of the pull request https://travis-ci.org/#!/gitlabhq/gitlabhq/builds/2575238

dosire commented 12 years ago
vagrant@precise32:/vagrant/gitlabhq$ RAILS_ENV=test rake db:migrate
==  PostgresCreateIntegerCast: migrating ======================================
-- execute("      CREATE CAST (integer AS text) WITH INOUT AS IMPLICIT;\n")
==  PostgresCreateIntegerCast: migrated (0.0059s) =============================
maxlazio commented 12 years ago

RAILS_ENV=test rake db:migrate

git diff

diff --git a/db/schema.rb b/db/schema.rb index ec4729c..00838ad 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ #

It's strongly recommended to check this file into your version control system.

-ActiveRecord::Schema.define(:version => 20121002151033) do +ActiveRecord::Schema.define(:version => 20121009205010) do

create_table "events", :force => true do |t| t.string "target_type" @@ -116,7 +116,6 @@ ActiveRecord::Schema.define(:version => 20121002151033) do t.boolean "wall_enabled", :default => true, :null => false t.boolean "merge_requests_enabled", :default => true, :null => false t.boolean "wiki_enabled", :default => true, :null => false

dosire commented 12 years ago
vagrant@precise32:/vagrant/gitlabhq$ git diff
diff --git a/db/schema.rb b/db/schema.rb
index ec4729c..a703781 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
 #
 # It's strongly recommended to check this file into your version control system.

-ActiveRecord::Schema.define(:version => 20121002151033) do
+ActiveRecord::Schema.define(:version => 20121009205010) do

   create_table "events", :force => true do |t|
     t.string   "target_type"
dosire commented 12 years ago
  1. Always add our remote git remote set-url origin git://github.com/dosire/gitlabhq.git
  2. Update our master (see Development Doc)
  3. Branch (fix-view-references)
  4. Push to branch
  5. Send PR to dosire
dosire commented 12 years ago

I made a PR for the Postgres issue https://github.com/gitlabhq/gitlab-vagrant-vm/pull/6

maxlazio commented 12 years ago

In master problems described in comment https://github.com/dosire/gitlab-vagrant-vm/issues/1#issuecomment-9591486 do not exist anymore but the tests are failing with our original problem(https://github.com/dosire/gitlab-vagrant-vm/issues/1#issuecomment-9303445) .

maxlazio commented 12 years ago

However, now I can get failing tests with running one feature.

maxlazio commented 12 years ago

On consecutive runs of one feature test results vary, they fail and they pass.