{"id":20561462,"url":"https://github.com/brabster/docker-fixture","last_synced_at":"2025-04-14T14:11:11.891Z","repository":{"id":62432502,"uuid":"75498513","full_name":"brabster/docker-fixture","owner":"brabster","description":"Docker containers as clojure.test fixtures","archived":false,"fork":false,"pushed_at":"2017-03-11T11:13:42.000Z","size":12,"stargazers_count":21,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-08-10T03:17:14.363Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"epl-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/brabster.png","metadata":{"files":{"readme":"README.org","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-12-03T20:29:22.000Z","updated_at":"2019-08-12T06:17:25.000Z","dependencies_parsed_at":"2022-11-01T21:01:09.424Z","dependency_job_id":null,"html_url":"https://github.com/brabster/docker-fixture","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brabster%2Fdocker-fixture","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brabster%2Fdocker-fixture/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brabster%2Fdocker-fixture/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brabster%2Fdocker-fixture/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/brabster","download_url":"https://codeload.github.com/brabster/docker-fixture/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224873069,"owners_count":17384079,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-16T03:58:10.044Z","updated_at":"2024-11-16T03:58:10.668Z","avatar_url":"https://github.com/brabster.png","language":"Clojure","readme":"* docker-fixture\n\nDocker containers as clojure.test fixtures\n\n[[https://travis-ci.org/brabster/docker-fixture][https://img.shields.io/travis/brabster/docker-fixture.svg]]\n[[https://github.com/brabster/docker-fixture/releases/latest][https://img.shields.io/github/release/brabster/docker-fixture.svg]]\n\nGet the latest version on [[https://clojars.org/docker-fixture][Clojars]]\n\n* Usage\n\n#+BEGIN_SRC clojure\n(ns docker.fixture-test\n  (:require [docker.fixture :as docker]\n            [clj-http.lite.client :as http]\n            [clojure.test :refer :all]))\n\n;; get a random port in the ephemeral range\n(def port (docker/rand-port))\n\n;; get the docker host we should connect to\n(def host (docker/host))\n\n;; prove interaction with fixture by init-fn\n(def fixture-response (atom nil))\n\n;; easy http GET\n(defn component-http-get\n  ([host port]\n   (http/get (str \"http://\" host \":\" port \"/knock-knock\"))))\n\n;; start and HTTP server that echos responses\n;; request it in init-fn and put the response in the fixture-response atom...\n(use-fixtures :once\n  (docker/new-fixture {:cmd [\"docker\" \"run\" \"-d\" \"-p\" (str port \":80\") \"keisato/http-echo\"]\n                       :sleep 500\n                       :init-fn (fn [component]\n                                  (reset! fixture-response\n                                          (component-http-get (:host component) port)))}))\n\n;; did the init-fn interact with the fixture?\n(deftest test-fixture-init\n  (is (= 200 (:status @fixture-response))))\n\n;; can we interact with the fixture now?\n(deftest test-fixture-interact\n  (is (= 200 (:status (component-http-get host port)))))\n#+END_SRC\n\n* License\n\nCopyright © 2016 Paul Brabban\n\nDistributed under the Eclipse Public License either version 1.0 or (at\nyour option) any later version.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrabster%2Fdocker-fixture","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrabster%2Fdocker-fixture","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrabster%2Fdocker-fixture/lists"}