{"action":"created","issue":{"url":"https://api.github.com/repos/openshift/origin/issues/6236","labels_url":"https://api.github.com/repos/openshift/origin/issues/6236/labels{/name}","comments_url":"https://api.github.com/repos/openshift/origin/issues/6236/comments","events_url":"https://api.github.com/repos/openshift/origin/issues/6236/events","html_url":"https://github.com/openshift/origin/issues/6236","id":121056328,"number":6236,"title":"Extended tests: add debugging tips/troubleshooting guide","user":{"login":"php-coder","id":87088,"avatar_url":"https://avatars.githubusercontent.com/u/87088?v=3","gravatar_id":"","url":"https://api.github.com/users/php-coder","html_url":"https://github.com/php-coder","followers_url":"https://api.github.com/users/php-coder/followers","following_url":"https://api.github.com/users/php-coder/following{/other_user}","gists_url":"https://api.github.com/users/php-coder/gists{/gist_id}","starred_url":"https://api.github.com/users/php-coder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/php-coder/subscriptions","organizations_url":"https://api.github.com/users/php-coder/orgs","repos_url":"https://api.github.com/users/php-coder/repos","events_url":"https://api.github.com/users/php-coder/events{/privacy}","received_events_url":"https://api.github.com/users/php-coder/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-12-08T17:23:04Z","updated_at":"2015-12-09T08:35:07Z","closed_at":null,"body":"During my work on #6197 there were a couple of obstacles that could be show-stopper for a newcomers. Especially when you're trying to debug tests. I would like to see a few words about possible problems and debugging technics in documentation/README/etc.\r\n\r\nMy cases:\r\n\r\n1) Permission denied when you run tests inside of vagrant:\r\n\r\n```\r\n[vagrant@localhost extended]$ ./core.sh \r\npackage github.com/davecgh/go-spew/spew: mkdir /data/src/github.com/davecgh/: permission denied\r\npackage github.com/docker/libcontainer/cgroups/fs: mkdir /data/src/github.com/docker/: permission denied\r\npackage github.com/docker/libcontainer/configs: cannot find package \"github.com/docker/libcontainer/configs\" in any of:\r\n\t/usr/lib/golang/src/github.com/docker/libcontainer/configs (from $GOROOT)\r\n\t/data/src/github.com/docker/libcontainer/configs (from $GOPATH)\r\npackage github.com/golang/glog: mkdir /data/src/github.com/golang/: permission denied\r\npackage github.com/juju/ratelimit: mkdir /data/src/github.com/juju/: permission denied\r\npackage github.com/pborman/uuid: mkdir /data/src/github.com/pborman/: permission denied\r\npackage github.com/prometheus/client_golang/prometheus: mkdir /data/src/github.com/prometheus/: permission denied\r\npackage github.com/spf13/pflag: mkdir /data/src/github.com/spf13/: permission denied\r\npackage github.com/google/gofuzz: mkdir /data/src/github.com/google/: permission denied\r\n```\r\nThe problem: tests tries to run `go get` but they don't have permissions.\r\n\r\nWorkaround/fix from @rhcarvalho is to create file `.vagrant-openshift.json` (in the same dir as `Vagrantfile`):\r\n\r\n```json\r\n{\r\n  \"sync_from\": \"~/git/src\",\r\n  \"sync_to\": \"/data/src\"\r\n}\r\n```\r\nand reload the vagrant.\r\n\r\n2) When you tried to debug tests you could have strange errors:\r\n\r\n```\r\n[vagrant@localhost origin]$ sh -x ./test/extended/core.sh \r\n+ set -o errexit\r\n+ set -o nounset\r\n+ set -o pipefail\r\n+ go get -d k8s.io/kubernetes/pkg/util\r\n+ export KUBE_REPO_ROOT=/home/vagrant/go:/data/src/k8s.io/kubernetes\r\n+ KUBE_REPO_ROOT=/home/vagrant/go:/data/src/k8s.io/kubernetes\r\n++ dirname ./test/extended/core.sh\r\n+ OS_ROOT=./test/extended/../..\r\n+ source ./test/extended/../../hack/util.sh\r\n++ TIME_SEC=1000\r\n++ TIME_MIN=60000\r\n./test/extended/../../hack/util.sh: line 601: `os::build:wait_for_start': not a valid identifier\r\n```\r\nThis is because tests uses `bash` and I run them with `sh`. So, don't use `sh -x`, only `bash -x` if you want to see what script is doing.\r\n\r\n3) When you try to write something from integration tests to the console with `fmt.Printf()` it won't shown. You should use `fmt.Fprintf(g.GinkgoWriter, msg)` instead.\r\n\r\n4) Hint from @mnagy: when test fails and you need to explore the state of the openshift and run some commands you could put sleep command inside of the the test and find in the scripts output string like this: `[INFO] To debug: export KUBECONFIG=/tmp/openshift-extended-tests/core/openshift.local.config/master/admin.kubeconfig` When you execute this command you will be able to use `oc` command as usual.\r\n\r\nProbably, @PI-Victor and @mfojtik could provide other such tricks and possible problems."},"comment":{"url":"https://api.github.com/repos/openshift/origin/issues/comments/163150210","html_url":"https://github.com/openshift/origin/issues/6236#issuecomment-163150210","issue_url":"https://api.github.com/repos/openshift/origin/issues/6236","id":163150210,"user":{"login":"PI-Victor","id":6294120,"avatar_url":"https://avatars.githubusercontent.com/u/6294120?v=3","gravatar_id":"","url":"https://api.github.com/users/PI-Victor","html_url":"https://github.com/PI-Victor","followers_url":"https://api.github.com/users/PI-Victor/followers","following_url":"https://api.github.com/users/PI-Victor/following{/other_user}","gists_url":"https://api.github.com/users/PI-Victor/gists{/gist_id}","starred_url":"https://api.github.com/users/PI-Victor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PI-Victor/subscriptions","organizations_url":"https://api.github.com/users/PI-Victor/orgs","repos_url":"https://api.github.com/users/PI-Victor/repos","events_url":"https://api.github.com/users/PI-Victor/events{/privacy}","received_events_url":"https://api.github.com/users/PI-Victor/received_events","type":"User","site_admin":false},"created_at":"2015-12-09T08:35:06Z","updated_at":"2015-12-09T08:35:06Z","body":"Rodolfo is right, you can add that json or you could modify the Vagrantfile and have it separate from the repo. My .json looks something like this:\r\n```\r\n  \"sync_to\": \"/data/src\",\r\n  \"sync_from\": \"/home/ipalade/projects/golang/src\",\r\n```\r\nthus loading all of my Go libs.\r\n\r\nI did modify that Vagrantfile on which my current vm is built and not the .json, however both would work. It sucks that it specifically loads only your openshift project when of course, you need the rest of the go libs as well.\r\nAs for your above problems i don't remember if i encountered them or not, the tests pretty much work for me right now.\r\n"}}