diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 23a7d76b4..f9629c3f5 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -7,7 +7,10 @@ jobs: test: runs-on: ubuntu-latest env: - ELASTIC_PASSWORD: changeme + MEMCACHE_SERVERS: "localhost:11211" + MYSQL_HOST: "localhost:3306" + ES_HOST: "localhost:9200" + ELASTIC_PASSWORD: "changeme" services: memcached: image: memcached:1.4.31 diff --git a/spec/concerns/wikidatable_spec.rb b/spec/concerns/wikidatable_spec.rb index 20ae10fe4..bf12c1f1a 100644 --- a/spec/concerns/wikidatable_spec.rb +++ b/spec/concerns/wikidatable_spec.rb @@ -8,7 +8,7 @@ context "find_by_wikidata_id" do it "for entity" do id = "Q35794" - result = subject.find_by(wikidata_id: id) + result = subject.find_by_wikidata_id(id) organization = result[:data].first expect(organization.id).to eq("Q35794") diff --git a/spec/fixtures/vcr_cassettes/Person/wikidata_query/employment.yml b/spec/fixtures/vcr_cassettes/Person/wikidata_query/employment.yml index 5be954736..bfd289ace 100644 --- a/spec/fixtures/vcr_cassettes/Person/wikidata_query/employment.yml +++ b/spec/fixtures/vcr_cassettes/Person/wikidata_query/employment.yml @@ -16,14 +16,18 @@ http_interactions: code: 200 message: OK headers: - Server: - - nginx/1.16.1 - Cache-Control: - - no-cache, no-store, max-age=0, must-revalidate + Date: + - Sun, 22 Nov 2020 12:05:33 GMT Content-Type: - application/json;charset=UTF-8 - Date: - - Thu, 03 Sep 2020 15:51:19 GMT + Connection: + - keep-alive + Set-Cookie: + - __cfduid=dc97dec7c6c8cf546ccb000bdd7eff5341606046733; expires=Tue, 22-Dec-20 + 12:05:33 GMT; path=/; domain=.orcid.org; HttpOnly; SameSite=Lax, X-Mapping-fjhppofk=4842165633BFDE68C17EFF06BB2B96E5; + path=/ + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate Expires: - '0' Pragma: @@ -34,21 +38,27 @@ http_interactions: - "*" X-Content-Type-Options: - nosniff - Connection: - - keep-alive - Set-Cookie: - - X-Mapping-fjhppofk=1F5FD8D0B8B1A8DD0F8680D854A2C10B; path=/ X-Frame-Options: - DENY + Cf-Cache-Status: + - DYNAMIC + Cf-Request-Id: + - '0691716bd3000021b7eab90000000001' + Expect-Ct: + - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" + Server: + - cloudflare + Cf-Ray: + - 5f6284f2eba221b7-DUS body: encoding: ASCII-8BIT string: !binary |- eyJsYXN0LW1vZGlmaWVkLWRhdGUiOnsidmFsdWUiOjE1OTkwNTg5MzI0NDZ9LCJhZmZpbGlhdGlvbi1ncm91cCI6W3sibGFzdC1tb2RpZmllZC1kYXRlIjp7InZhbHVlIjoxNTYxODIzMTkxMTk4fSwiZXh0ZXJuYWwtaWRzIjp7ImV4dGVybmFsLWlkIjpbXX0sInN1bW1hcmllcyI6W3siZW1wbG95bWVudC1zdW1tYXJ5Ijp7ImNyZWF0ZWQtZGF0ZSI6eyJ2YWx1ZSI6MTQzOTMyODUzMzA4N30sImxhc3QtbW9kaWZpZWQtZGF0ZSI6eyJ2YWx1ZSI6MTU2MTgyMzE5MTE5OH0sInNvdXJjZSI6eyJzb3VyY2Utb3JjaWQiOnsidXJpIjoiaHR0cHM6Ly9vcmNpZC5vcmcvMDAwMC0wMDAzLTE0MTktMjQwNSIsInBhdGgiOiIwMDAwLTAwMDMtMTQxOS0yNDA1IiwiaG9zdCI6Im9yY2lkLm9yZyJ9LCJzb3VyY2UtY2xpZW50LWlkIjpudWxsLCJzb3VyY2UtbmFtZSI6eyJ2YWx1ZSI6Ik1hcnRpbiBGZW5uZXIifSwiYXNzZXJ0aW9uLW9yaWdpbi1vcmNpZCI6bnVsbCwiYXNzZXJ0aW9uLW9yaWdpbi1jbGllbnQtaWQiOm51bGwsImFzc2VydGlvbi1vcmlnaW4tbmFtZSI6bnVsbH0sInB1dC1jb2RlIjoxMDg5MjU3LCJkZXBhcnRtZW50LW5hbWUiOm51bGw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ZGljaW5lIiwic3RhcnQtZGF0ZSI6eyJ5ZWFyIjp7InZhbHVlIjoiMTk5OCJ9LCJtb250aCI6eyJ2YWx1ZSI6IjA5In0sImRheSI6bnVsbH0sImVuZC1kYXRlIjp7InllYXIiOnsidmFsdWUiOiIyMDA1In0sIm1vbnRoIjp7InZhbHVlIjoiMTAifSwiZGF5IjpudWxsfSwib3JnYW5pemF0aW9uIjp7Im5hbWUiOiJDaGFyaXTDqSBVbml2ZXJzaXTDpHRzbWVkaXppbiBCZXJsaW4iLCJhZGRyZXNzIjp7ImNpdHkiOiJCZXJsaW4iLCJyZWdpb24iOiJCZXJsaW4iLCJjb3VudHJ5IjoiREUifSwiZGlzYW1iaWd1YXRlZC1vcmdhbml6YXRpb24iOnsiZGlzYW1iaWd1YXRlZC1vcmdhbml6YXRpb24taWRlbnRpZmllciI6IjE0OTAzIiwiZGlzYW1iaWd1YXRpb24tc291cmNlIjoiUklOR0dPTEQifX0sInVybCI6bnVsbCwiZXh0ZXJuYWwtaWRzIjpudWxsLCJkaXNwbGF5LWluZGV4IjoiMSIsInZpc2liaWxpdHkiOiJwdWJsaWMiLCJwYXRoIjoiLzAwMDAtMDAwMy0xNDE5LTI0MDUvZW1wbG95bWVudC80MzYzIn19XX1dLCJwYXRoIjoiLzAwMDAtMDAwMy0xNDE5LTI0MDUvZW1wbG95bWVudHMifQ== http_version: null - recorded_at: Thu, 03 Sep 2020 15:51:20 GMT + recorded_at: Sun, 22 Nov 2020 12:05:33 GMT - request: method: get - uri: https://query.wikidata.org/sparql?query=%20%20%20%20%20%20PREFIX%20wikibase:%20%3Chttp://wikiba.se/ontology%23%3E%0A%20%20%20%20%20%20PREFIX%20wd:%20%3Chttp://www.wikidata.org/entity/%3E%20%0A%20%20%20%20%20%20PREFIX%20wdt:%20%3Chttp://www.wikidata.org/prop/direct/%3E%0A%20%20%20%20%20%20PREFIX%20rdfs:%20%3Chttp://www.w3.org/2000/01/rdf-schema%23%3E%0A%20%20%20%20%20%20PREFIX%20p:%20%3Chttp://www.wikidata.org/prop/%3E%0A%20%20%20%20%20%20PREFIX%20v:%20%3Chttp://www.wikidata.org/prop/statement/%3E%0A%0A%20%20%20%20%20%20SELECT%20?item%20?itemLabel%20?ror%20?grid%20?ringgold%20WHERE%20%7B%0A%20%20%20%20%20%20%20%20?item%20wdt:P6782%20?ror.%0A%20%20%20%20%20%20%20%20OPTIONAL%20%7B%20?item%20wdt:P2427%20?grid.%20%7D%0A%20%20%20%20%20%20%20%20OPTIONAL%20%7B%20?item%20wdt:P3500%20?ringgold.%20%7D%0A%20%20%20%20%20%20%20%20%0A%20%20%20%20%20%20%20%20FILTER(?ringgold%20in%20(%22%22)%20%7C%7C%20?grid%20in%20(%22%22)).%0A%20%20%20%20%20%20%20%20%20%20%20SERVICE%20wikibase:label%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20bd:serviceParam%20wikibase:language%20%22%5BAUTO_LANGUAGE%5D%22%20.%0A%20%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%20%7D + uri: https://query.wikidata.org/sparql?query=%20%20%20%20%20%20PREFIX%20wikibase:%20%3Chttp://wikiba.se/ontology%23%3E%0A%20%20%20%20%20%20PREFIX%20wd:%20%3Chttp://www.wikidata.org/entity/%3E%0A%20%20%20%20%20%20PREFIX%20wdt:%20%3Chttp://www.wikidata.org/prop/direct/%3E%0A%20%20%20%20%20%20PREFIX%20rdfs:%20%3Chttp://www.w3.org/2000/01/rdf-schema%23%3E%0A%20%20%20%20%20%20PREFIX%20p:%20%3Chttp://www.wikidata.org/prop/%3E%0A%20%20%20%20%20%20PREFIX%20v:%20%3Chttp://www.wikidata.org/prop/statement/%3E%0A%0A%20%20%20%20%20%20SELECT%20?item%20?itemLabel%20?ror%20?grid%20?ringgold%20WHERE%20%7B%0A%20%20%20%20%20%20%20%20?item%20wdt:P6782%20?ror.%0A%20%20%20%20%20%20%20%20OPTIONAL%20%7B%20?item%20wdt:P2427%20?grid.%20%7D%0A%20%20%20%20%20%20%20%20OPTIONAL%20%7B%20?item%20wdt:P3500%20?ringgold.%20%7D%0A%0A%20%20%20%20%20%20%20%20FILTER(?ringgold%20in%20(%22%22)%20%7C%7C%20?grid%20in%20(%22%22)).%0A%20%20%20%20%20%20%20%20%20%20%20SERVICE%20wikibase:label%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20bd:serviceParam%20wikibase:language%20%22%5BAUTO_LANGUAGE%5D%22%20.%0A%20%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%20%7D body: encoding: US-ASCII string: '' @@ -72,13 +82,13 @@ http_interactions: Server: - nginx/1.13.6 Date: - - Thu, 03 Sep 2020 15:51:24 GMT + - Sun, 22 Nov 2020 12:05:39 GMT Content-Type: - application/sparql-results+json;charset=utf-8 X-First-Solution-Millis: - '5' X-Served-By: - - wdqs2002 + - wdqs1007 Access-Control-Allow-Origin: - "*" Cache-Control: @@ -86,22 +96,28 @@ http_interactions: Vary: - Accept, Accept-Encoding Age: - - '4' + - '5' X-Cache: - - cp3050 miss, cp3064 pass + - cp3064 miss, cp3056 pass X-Cache-Status: - pass Server-Timing: - cache;desc="pass" Strict-Transport-Security: - max-age=106384710; includeSubDomains; preload + Report-To: + - '{ "group": "wm_nel", "max_age": 86400, "endpoints": [{ "url": "https://intake-logging.wikimedia.org/v1/events?stream=w3c.reportingapi.network_error&schema_uri=/w3c/reportingapi/network_error/1.0.0" + }] }' + Nel: + - '{ "report_to": "wm_nel", "max_age": 86400, "failure_fraction": 0.05, "success_fraction": + 0.0}' Set-Cookie: - - WMF-Last-Access-Global=03-Sep-2020;Path=/;Domain=.wikidata.org;HttpOnly;secure;Expires=Mon, - 05 Oct 2020 12:00:00 GMT - - WMF-Last-Access=03-Sep-2020;Path=/;HttpOnly;secure;Expires=Mon, 05 Oct 2020 + - WMF-Last-Access-Global=22-Nov-2020;Path=/;Domain=.wikidata.org;HttpOnly;secure;Expires=Thu, + 24 Dec 2020 12:00:00 GMT + - WMF-Last-Access=22-Nov-2020;Path=/;HttpOnly;secure;Expires=Thu, 24 Dec 2020 12:00:00 GMT X-Client-Ip: - - 87.155.5.120 + - 87.155.6.170 Accept-Ranges: - bytes Content-Length: @@ -120,5 +136,5 @@ http_interactions: } } http_version: null - recorded_at: Thu, 03 Sep 2020 15:51:24 GMT + recorded_at: Sun, 22 Nov 2020 12:05:39 GMT recorded_with: VCR 5.1.0 diff --git a/spec/models/other_doi_spec.rb b/spec/models/other_doi_spec.rb index fb1ac2a4f..e8eb8168c 100644 --- a/spec/models/other_doi_spec.rb +++ b/spec/models/other_doi_spec.rb @@ -2,7 +2,7 @@ require "rails_helper" -describe OtherDoi, type: :model, vcr: true do +describe OtherDoi, type: :model do it_behaves_like "an STI class" describe "import_by_ids", elasticsearch: true do @@ -18,6 +18,7 @@ it "import by id" do response = OtherDoi.import_by_id(id: doi.id) + sleep 2 expect(response).to eq(3) end end