{"action":"created","comment":{"url":"https://api.github.com/repos/openshift/postgresql/pulls/comments/26931292","id":26931292,"diff_hunk":"@@ -0,0 +1,169 @@\n+#!/bin/bash\n+#\n+# Test the PostgreSQL image.\n+#\n+# IMAGE_NAME specifies the name of the candidate image used for testing.\n+# The image has to be available before this script is executed.\n+#\n+\n+set -exo nounset\n+shopt -s nullglob\n+\n+IMAGE_NAME=${IMAGE_NAME-openshift/postgresql-92-centos7-candidate}\n+\n+CIDFILE_DIR=$(mktemp --suffix=postgresql_test_cidfiles -d)\n+\n+function cleanup {\n+\tfor cidfile in $CIDFILE_DIR/* ; do\n+\t\tCONTAINER=$(cat $cidfile)\n+\n+\t\techo \"Stopping and removing container $CONTAINER...\"\n+\t\tdocker stop $CONTAINER\n+\t\texit_status=$(docker inspect -f '{{.State.ExitCode}}' $CONTAINER)\n+\t\tif [ \"$exit_status\" != \"0\" ]; then\n+\t\t\techo \"Dumping logs for $CONTAINER\"\n+\t\t\tdocker logs $CONTAINER\n+\t\tfi\n+\t\tdocker rm $CONTAINER\n+\t\trm $cidfile\n+\t\techo \"Done.\"\n+\tdone\n+\trmdir $CIDFILE_DIR\n+}\n+trap cleanup EXIT\n+\n+function get_cid {\n+\tlocal id=\"$1\" ; shift || return 1\n+\techo $(cat \"$CIDFILE_DIR/$id\")\n+}\n+\n+function get_container_ip {\n+\tlocal id=\"$1\" ; shift\n+\tdocker inspect --format='{{.NetworkSettings.IPAddress}}' $(get_cid \"$id\")\n+}\n+\n+function postgresql_cmd {\n+\tdocker run --rm -e PGPASSWORD=\"${PASS}\" $IMAGE_NAME psql postgresql://$USER@$CONTAINER_IP:5432/db \"$@\"\n+}\n+\n+function test_connection {\n+\tlocal name=$1 ; shift\n+\tip=$(get_container_ip $name)\n+\techo \"  Testing PostgreSQL connection to $ip...\"\n+\tlocal max_attempts=20\n+\tlocal sleep_time=2\n+\tfor i in $(seq $max_attempts); do\n+\t\techo \"    Trying to connect...\"\n+\t\tset +e\n+\t\tpostgresql_cmd <<< \"SELECT 1;\"\n+\t\tstatus=$?\n+\t\tset -e\n+\t\tif [ $status -eq 0 ]; then\n+\t\t\techo \"  Success!\"\n+\t\t\treturn 0\n+\t\tfi\n+\t\tsleep $sleep_time\n+\tdone\n+\treturn 1\n+}\n+\n+function test_postgresql {\n+\techo \"  Testing PostgreSQL\"\n+\tpostgresql_cmd <<< \"CREATE TABLE tbl (col1 VARCHAR(20), col2 VARCHAR(20));\"\n+\tpostgresql_cmd <<< \"INSERT INTO tbl VALUES ('foo1', 'bar1');\"\n+\tpostgresql_cmd <<< \"INSERT INTO tbl VALUES ('foo2', 'bar2');\"\n+\tpostgresql_cmd <<< \"INSERT INTO tbl VALUES ('foo3', 'bar3');\"\n+\tpostgresql_cmd <<< \"SELECT * FROM tbl;\"\n+\tpostgresql_cmd <<< \"DROP TABLE tbl;\"\n+\techo \"  Success!\"\n+}\n+\n+function create_container {\n+\tlocal name=$1 ; shift\n+\tcidfile=\"$CIDFILE_DIR/$name\"\n+\t# create container with a cidfile in a directory for cleanup\n+\tdocker run --cidfile $cidfile -d \"$@\" $IMAGE_NAME\n+\techo \"Created container $(cat $cidfile)\"\n+}\n+\n+function assert_login_access {\n+\tlocal USER=$1 ; shift\n+\tlocal PASS=$1 ; shift\n+\tlocal success=$1 ; shift\n+\n+\tif $success; then\n+\t\tpostgresql_cmd <<< \"SELECT 1;\" &&\n+\t\t\techo \"    $USER($PASS) access granted as expected\"\n+\telse\n+\t\tpostgresql_cmd <<< \"SELECT 1;\" ||\n+\t\t\techo \"    $USER($PASS) access denied as expected\"\n+\tfi\n+}\n+\n+# Make sure the invocation of docker run fails.\n+function assert_image_creation_fails {","path":"9.2/test/run","position":104,"original_position":104,"commit_id":"c9d73075a358ea8adf33ae711c7e586dcd7fc415","original_commit_id":"c9d73075a358ea8adf33ae711c7e586dcd7fc415","user":{"login":"jhadvig","id":1668218,"avatar_url":"https://avatars.githubusercontent.com/u/1668218?v=3","gravatar_id":"","url":"https://api.github.com/users/jhadvig","html_url":"https://github.com/jhadvig","followers_url":"https://api.github.com/users/jhadvig/followers","following_url":"https://api.github.com/users/jhadvig/following{/other_user}","gists_url":"https://api.github.com/users/jhadvig/gists{/gist_id}","starred_url":"https://api.github.com/users/jhadvig/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jhadvig/subscriptions","organizations_url":"https://api.github.com/users/jhadvig/orgs","repos_url":"https://api.github.com/users/jhadvig/repos","events_url":"https://api.github.com/users/jhadvig/events{/privacy}","received_events_url":"https://api.github.com/users/jhadvig/received_events","type":"User","site_admin":false},"body":"It should be `assert_container_creation_fails`","created_at":"2015-03-23T12:13:27Z","updated_at":"2015-03-23T12:13:27Z","html_url":"https://github.com/openshift/postgresql/pull/1#discussion_r26931292","pull_request_url":"https://api.github.com/repos/openshift/postgresql/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/openshift/postgresql/pulls/comments/26931292"},"html":{"href":"https://github.com/openshift/postgresql/pull/1#discussion_r26931292"},"pull_request":{"href":"https://api.github.com/repos/openshift/postgresql/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/openshift/postgresql/pulls/1","id":31528207,"html_url":"https://github.com/openshift/postgresql/pull/1","diff_url":"https://github.com/openshift/postgresql/pull/1.diff","patch_url":"https://github.com/openshift/postgresql/pull/1.patch","issue_url":"https://api.github.com/repos/openshift/postgresql/issues/1","number":1,"state":"open","locked":false,"title":"Add PosgreSQL 9.2 image","user":{"login":"mnagy","id":72469,"avatar_url":"https://avatars.githubusercontent.com/u/72469?v=3","gravatar_id":"","url":"https://api.github.com/users/mnagy","html_url":"https://github.com/mnagy","followers_url":"https://api.github.com/users/mnagy/followers","following_url":"https://api.github.com/users/mnagy/following{/other_user}","gists_url":"https://api.github.com/users/mnagy/gists{/gist_id}","starred_url":"https://api.github.com/users/mnagy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mnagy/subscriptions","organizations_url":"https://api.github.com/users/mnagy/orgs","repos_url":"https://api.github.com/users/mnagy/repos","events_url":"https://api.github.com/users/mnagy/events{/privacy}","received_events_url":"https://api.github.com/users/mnagy/received_events","type":"User","site_admin":false},"body":"It is based on the MySQL image and works similarly. You must set\n`POSTGRESQL_{USER,PASSWORD,DATABASE}` environment variables and can\noptionally set the 'postgres' db user password using the\n`POSTGRESQL_ADMIN_PASSWORD` variable.\n\nThere are few minor outstanding issues that are marked and commented\nwith a `TODO`. Ideas and suggestions would be appreciated.\n\nYou can test the image with `make test && make test TARGET=rhel7`.\n\nDocumentation in README is still missing, but wanted early feedback.","created_at":"2015-03-19T14:30:55Z","updated_at":"2015-03-23T12:13:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e5336897a285644e5bc80d604c3b5c5b3a97d3fe","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/openshift/postgresql/pulls/1/commits","review_comments_url":"https://api.github.com/repos/openshift/postgresql/pulls/1/comments","review_comment_url":"https://api.github.com/repos/openshift/postgresql/pulls/comments{/number}","comments_url":"https://api.github.com/repos/openshift/postgresql/issues/1/comments","statuses_url":"https://api.github.com/repos/openshift/postgresql/statuses/c9d73075a358ea8adf33ae711c7e586dcd7fc415","head":{"label":"mnagy:initial","ref":"initial","sha":"c9d73075a358ea8adf33ae711c7e586dcd7fc415","user":{"login":"mnagy","id":72469,"avatar_url":"https://avatars.githubusercontent.com/u/72469?v=3","gravatar_id":"","url":"https://api.github.com/users/mnagy","html_url":"https://github.com/mnagy","followers_url":"https://api.github.com/users/mnagy/followers","following_url":"https://api.github.com/users/mnagy/following{/other_user}","gists_url":"https://api.github.com/users/mnagy/gists{/gist_id}","starred_url":"https://api.github.com/users/mnagy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mnagy/subscriptions","organizations_url":"https://api.github.com/users/mnagy/orgs","repos_url":"https://api.github.com/users/mnagy/repos","events_url":"https://api.github.com/users/mnagy/events{/privacy}","received_events_url":"https://api.github.com/users/mnagy/received_events","type":"User","site_admin":false},"repo":{"id":32481340,"name":"postgresql","full_name":"mnagy/postgresql","owner":{"login":"mnagy","id":72469,"avatar_url":"https://avatars.githubusercontent.com/u/72469?v=3","gravatar_id":"","url":"https://api.github.com/users/mnagy","html_url":"https://github.com/mnagy","followers_url":"https://api.github.com/users/mnagy/followers","following_url":"https://api.github.com/users/mnagy/following{/other_user}","gists_url":"https://api.github.com/users/mnagy/gists{/gist_id}","starred_url":"https://api.github.com/users/mnagy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mnagy/subscriptions","organizations_url":"https://api.github.com/users/mnagy/orgs","repos_url":"https://api.github.com/users/mnagy/repos","events_url":"https://api.github.com/users/mnagy/events{/privacy}","received_events_url":"https://api.github.com/users/mnagy/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mnagy/postgresql","description":"","fork":true,"url":"https://api.github.com/repos/mnagy/postgresql","forks_url":"https://api.github.com/repos/mnagy/postgresql/forks","keys_url":"https://api.github.com/repos/mnagy/postgresql/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mnagy/postgresql/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mnagy/postgresql/teams","hooks_url":"https://api.github.com/repos/mnagy/postgresql/hooks","issue_events_url":"https://api.github.com/repos/mnagy/postgresql/issues/events{/number}","events_url":"https://api.github.com/repos/mnagy/postgresql/events","assignees_url":"https://api.github.com/repos/mnagy/postgresql/assignees{/user}","branches_url":"https://api.github.com/repos/mnagy/postgresql/branches{/branch}","tags_url":"https://api.github.com/repos/mnagy/postgresql/tags","blobs_url":"https://api.github.com/repos/mnagy/postgresql/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mnagy/postgresql/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mnagy/postgresql/git/refs{/sha}","trees_url":"https://api.github.com/repos/mnagy/postgresql/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mnagy/postgresql/statuses/{sha}","languages_url":"https://api.github.com/repos/mnagy/postgresql/languages","stargazers_url":"https://api.github.com/repos/mnagy/postgresql/stargazers","contributors_url":"https://api.github.com/repos/mnagy/postgresql/contributors","subscribers_url":"https://api.github.com/repos/mnagy/postgresql/subscribers","subscription_url":"https://api.github.com/repos/mnagy/postgresql/subscription","commits_url":"https://api.github.com/repos/mnagy/postgresql/commits{/sha}","git_commits_url":"https://api.github.com/repos/mnagy/postgresql/git/commits{/sha}","comments_url":"https://api.github.com/repos/mnagy/postgresql/comments{/number}","issue_comment_url":"https://api.github.com/repos/mnagy/postgresql/issues/comments{/number}","contents_url":"https://api.github.com/repos/mnagy/postgresql/contents/{+path}","compare_url":"https://api.github.com/repos/mnagy/postgresql/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mnagy/postgresql/merges","archive_url":"https://api.github.com/repos/mnagy/postgresql/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mnagy/postgresql/downloads","issues_url":"https://api.github.com/repos/mnagy/postgresql/issues{/number}","pulls_url":"https://api.github.com/repos/mnagy/postgresql/pulls{/number}","milestones_url":"https://api.github.com/repos/mnagy/postgresql/milestones{/number}","notifications_url":"https://api.github.com/repos/mnagy/postgresql/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mnagy/postgresql/labels{/name}","releases_url":"https://api.github.com/repos/mnagy/postgresql/releases{/id}","created_at":"2015-03-18T20:04:26Z","updated_at":"2015-03-18T15:15:47Z","pushed_at":"2015-03-23T09:56:28Z","git_url":"git://github.com/mnagy/postgresql.git","ssh_url":"git@github.com:mnagy/postgresql.git","clone_url":"https://github.com/mnagy/postgresql.git","svn_url":"https://github.com/mnagy/postgresql","homepage":null,"size":0,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"openshift:master","ref":"master","sha":"82fb7147dc6d452e0b28fedb3eb2fc3aaf6922a2","user":{"login":"openshift","id":792337,"avatar_url":"https://avatars.githubusercontent.com/u/792337?v=3","gravatar_id":"","url":"https://api.github.com/users/openshift","html_url":"https://github.com/openshift","followers_url":"https://api.github.com/users/openshift/followers","following_url":"https://api.github.com/users/openshift/following{/other_user}","gists_url":"https://api.github.com/users/openshift/gists{/gist_id}","starred_url":"https://api.github.com/users/openshift/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openshift/subscriptions","organizations_url":"https://api.github.com/users/openshift/orgs","repos_url":"https://api.github.com/users/openshift/repos","events_url":"https://api.github.com/users/openshift/events{/privacy}","received_events_url":"https://api.github.com/users/openshift/received_events","type":"Organization","site_admin":false},"repo":{"id":32466378,"name":"postgresql","full_name":"openshift/postgresql","owner":{"login":"openshift","id":792337,"avatar_url":"https://avatars.githubusercontent.com/u/792337?v=3","gravatar_id":"","url":"https://api.github.com/users/openshift","html_url":"https://github.com/openshift","followers_url":"https://api.github.com/users/openshift/followers","following_url":"https://api.github.com/users/openshift/following{/other_user}","gists_url":"https://api.github.com/users/openshift/gists{/gist_id}","starred_url":"https://api.github.com/users/openshift/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openshift/subscriptions","organizations_url":"https://api.github.com/users/openshift/orgs","repos_url":"https://api.github.com/users/openshift/repos","events_url":"https://api.github.com/users/openshift/events{/privacy}","received_events_url":"https://api.github.com/users/openshift/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/openshift/postgresql","description":"","fork":false,"url":"https://api.github.com/repos/openshift/postgresql","forks_url":"https://api.github.com/repos/openshift/postgresql/forks","keys_url":"https://api.github.com/repos/openshift/postgresql/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openshift/postgresql/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openshift/postgresql/teams","hooks_url":"https://api.github.com/repos/openshift/postgresql/hooks","issue_events_url":"https://api.github.com/repos/openshift/postgresql/issues/events{/number}","events_url":"https://api.github.com/repos/openshift/postgresql/events","assignees_url":"https://api.github.com/repos/openshift/postgresql/assignees{/user}","branches_url":"https://api.github.com/repos/openshift/postgresql/branches{/branch}","tags_url":"https://api.github.com/repos/openshift/postgresql/tags","blobs_url":"https://api.github.com/repos/openshift/postgresql/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openshift/postgresql/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openshift/postgresql/git/refs{/sha}","trees_url":"https://api.github.com/repos/openshift/postgresql/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openshift/postgresql/statuses/{sha}","languages_url":"https://api.github.com/repos/openshift/postgresql/languages","stargazers_url":"https://api.github.com/repos/openshift/postgresql/stargazers","contributors_url":"https://api.github.com/repos/openshift/postgresql/contributors","subscribers_url":"https://api.github.com/repos/openshift/postgresql/subscribers","subscription_url":"https://api.github.com/repos/openshift/postgresql/subscription","commits_url":"https://api.github.com/repos/openshift/postgresql/commits{/sha}","git_commits_url":"https://api.github.com/repos/openshift/postgresql/git/commits{/sha}","comments_url":"https://api.github.com/repos/openshift/postgresql/comments{/number}","issue_comment_url":"https://api.github.com/repos/openshift/postgresql/issues/comments{/number}","contents_url":"https://api.github.com/repos/openshift/postgresql/contents/{+path}","compare_url":"https://api.github.com/repos/openshift/postgresql/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openshift/postgresql/merges","archive_url":"https://api.github.com/repos/openshift/postgresql/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openshift/postgresql/downloads","issues_url":"https://api.github.com/repos/openshift/postgresql/issues{/number}","pulls_url":"https://api.github.com/repos/openshift/postgresql/pulls{/number}","milestones_url":"https://api.github.com/repos/openshift/postgresql/milestones{/number}","notifications_url":"https://api.github.com/repos/openshift/postgresql/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openshift/postgresql/labels{/name}","releases_url":"https://api.github.com/repos/openshift/postgresql/releases{/id}","created_at":"2015-03-18T15:15:33Z","updated_at":"2015-03-19T13:49:02Z","pushed_at":"2015-03-23T09:56:29Z","git_url":"git://github.com/openshift/postgresql.git","ssh_url":"git@github.com:openshift/postgresql.git","clone_url":"https://github.com/openshift/postgresql.git","svn_url":"https://github.com/openshift/postgresql","homepage":null,"size":0,"stargazers_count":1,"watchers_count":1,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":2,"forks":2,"open_issues":2,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/openshift/postgresql/pulls/1"},"html":{"href":"https://github.com/openshift/postgresql/pull/1"},"issue":{"href":"https://api.github.com/repos/openshift/postgresql/issues/1"},"comments":{"href":"https://api.github.com/repos/openshift/postgresql/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/openshift/postgresql/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/openshift/postgresql/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/openshift/postgresql/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/openshift/postgresql/statuses/c9d73075a358ea8adf33ae711c7e586dcd7fc415"}}}}