From 35ba053c83b7ad18e1a336d50d3a8d5a53adce9f Mon Sep 17 00:00:00 2001 From: Peter Amstutz Date: Thu, 25 Jul 2019 09:41:09 -0400 Subject: [PATCH] 14717: Fixups since tests now use config.yml Also add curl oneliner to submit the current git head to developer-run-tests Arvados-DCO-1.1-Signed-off-by: Peter Amstutz --- .../test/controllers/healthcheck_controller_test.rb | 6 +++++- .../test/integration/anonymous_access_test.rb | 2 -- apps/workbench/test/integration/collections_test.rb | 2 -- apps/workbench/test/integration/download_test.rb | 2 -- apps/workbench/test/integration/jobs_test.rb | 2 -- apps/workbench/test/integration_helper.rb | 13 ------------- .../arvados/v1/healthcheck_controller_test.rb | 6 +++++- services/crunch-run/git_mount_test.go | 10 ++++++++-- tools/jenkins/submit-ci-dev.sh | 9 +++++++++ 9 files changed, 27 insertions(+), 25 deletions(-) create mode 100755 tools/jenkins/submit-ci-dev.sh diff --git a/apps/workbench/test/controllers/healthcheck_controller_test.rb b/apps/workbench/test/controllers/healthcheck_controller_test.rb index 45726e5a64..c3a0ddea90 100644 --- a/apps/workbench/test/controllers/healthcheck_controller_test.rb +++ b/apps/workbench/test/controllers/healthcheck_controller_test.rb @@ -16,7 +16,11 @@ class HealthcheckControllerTest < ActionController::TestCase [true, 'Bearer configuredmanagementtoken', 200, '{"health":"OK"}'], ].each do |enabled, header, error_code, error_msg| test "ping when #{if enabled then 'enabled' else 'disabled' end} with header '#{header}'" do - Rails.configuration.ManagementToken = 'configuredmanagementtoken' if enabled + if enabled + Rails.configuration.ManagementToken = 'configuredmanagementtoken' + else + Rails.configuration.ManagementToken = "" + end @request.headers['Authorization'] = header get :ping diff --git a/apps/workbench/test/integration/anonymous_access_test.rb b/apps/workbench/test/integration/anonymous_access_test.rb index c414f8a7ad..d3f08c62bf 100644 --- a/apps/workbench/test/integration/anonymous_access_test.rb +++ b/apps/workbench/test/integration/anonymous_access_test.rb @@ -5,8 +5,6 @@ require 'integration_helper' class AnonymousAccessTest < ActionDispatch::IntegrationTest - include KeepWebConfig - # These tests don't do state-changing API calls. Save some time by # skipping the database reset. reset_api_fixtures :after_each_test, false diff --git a/apps/workbench/test/integration/collections_test.rb b/apps/workbench/test/integration/collections_test.rb index 6dd3c52696..024a14605a 100644 --- a/apps/workbench/test/integration/collections_test.rb +++ b/apps/workbench/test/integration/collections_test.rb @@ -6,8 +6,6 @@ require 'integration_helper' require_relative 'integration_test_utils' class CollectionsTest < ActionDispatch::IntegrationTest - include KeepWebConfig - setup do need_javascript end diff --git a/apps/workbench/test/integration/download_test.rb b/apps/workbench/test/integration/download_test.rb index b19c00dae9..e2d3dc8ef3 100644 --- a/apps/workbench/test/integration/download_test.rb +++ b/apps/workbench/test/integration/download_test.rb @@ -6,8 +6,6 @@ require 'integration_helper' require 'helpers/download_helper' class DownloadTest < ActionDispatch::IntegrationTest - include KeepWebConfig - @@wrote_test_data = false setup do diff --git a/apps/workbench/test/integration/jobs_test.rb b/apps/workbench/test/integration/jobs_test.rb index b54a31380c..5dcdab748f 100644 --- a/apps/workbench/test/integration/jobs_test.rb +++ b/apps/workbench/test/integration/jobs_test.rb @@ -8,8 +8,6 @@ require 'tmpdir' require 'integration_helper' class JobsTest < ActionDispatch::IntegrationTest - include KeepWebConfig - setup do need_javascript end diff --git a/apps/workbench/test/integration_helper.rb b/apps/workbench/test/integration_helper.rb index 34ee1f479a..0c66e59c8c 100644 --- a/apps/workbench/test/integration_helper.rb +++ b/apps/workbench/test/integration_helper.rb @@ -156,19 +156,6 @@ module HeadlessHelper end end -module KeepWebConfig - def getport service - File.read(File.expand_path("../../../../tmp/#{service}.port", __FILE__)) - end - - def use_keep_web_config - @kwport = getport 'keep-web-ssl' - @kwdport = getport 'keep-web-dl-ssl' - Rails.configuration.Services.WebDAV.ExternalURL = URI("https://localhost:#{@kwport}") - Rails.configuration.Services.WebDAVDownload.ExternalURL = URI("https://localhost:#{@kwdport}") - end -end - class ActionDispatch::IntegrationTest # Make the Capybara DSL available in all integration tests include Capybara::DSL diff --git a/services/api/test/functional/arvados/v1/healthcheck_controller_test.rb b/services/api/test/functional/arvados/v1/healthcheck_controller_test.rb index 551eefa878..76fdb0426d 100644 --- a/services/api/test/functional/arvados/v1/healthcheck_controller_test.rb +++ b/services/api/test/functional/arvados/v1/healthcheck_controller_test.rb @@ -13,7 +13,11 @@ class Arvados::V1::HealthcheckControllerTest < ActionController::TestCase [true, 'Bearer configuredmanagementtoken', 200, '{"health":"OK"}'], ].each do |enabled, header, error_code, error_msg| test "ping when #{if enabled then 'enabled' else 'disabled' end} with header '#{header}'" do - Rails.configuration.ManagementToken = 'configuredmanagementtoken' if enabled + if enabled + Rails.configuration.ManagementToken = 'configuredmanagementtoken' + else + Rails.configuration.ManagementToken = "" + end @request.headers['Authorization'] = header get :ping diff --git a/services/crunch-run/git_mount_test.go b/services/crunch-run/git_mount_test.go index 4dc95bc3df..5796ad7a27 100644 --- a/services/crunch-run/git_mount_test.go +++ b/services/crunch-run/git_mount_test.go @@ -6,9 +6,11 @@ package main import ( "io/ioutil" + "net/url" "os" "path/filepath" + "git.curoverse.com/arvados.git/lib/config" "git.curoverse.com/arvados.git/sdk/go/arvados" "git.curoverse.com/arvados.git/sdk/go/arvadostest" check "gopkg.in/check.v1" @@ -203,7 +205,11 @@ func (s *GitMountSuite) checkTmpdirContents(c *check.C, expect []string) { func (*GitMountSuite) useTestGitServer(c *check.C) { git_client.InstallProtocol("https", git_http.NewClient(arvados.InsecureHTTPClient)) - port, err := ioutil.ReadFile("../../tmp/arv-git-httpd-ssl.port") + loader := config.NewLoader(nil, nil) + cfg, err := loader.Load() c.Assert(err, check.IsNil) - discoveryMap["gitUrl"] = "https://localhost:" + string(port) + cluster, err := cfg.GetCluster("") + c.Assert(err, check.IsNil) + + discoveryMap["gitUrl"] = (*url.URL)(&cluster.Services.GitHTTP.ExternalURL).String() } diff --git a/tools/jenkins/submit-ci-dev.sh b/tools/jenkins/submit-ci-dev.sh new file mode 100755 index 0000000000..7188c15250 --- /dev/null +++ b/tools/jenkins/submit-ci-dev.sh @@ -0,0 +1,9 @@ +#!/bin/sh +# Copyright (C) The Arvados Authors. All rights reserved. +# +# SPDX-License-Identifier: AGPL-3.0 + +head=$(git log --first-parent --max-count=1 --format=%H) +curl -X POST https://ci.curoverse.com/job/developer-run-tests/build \ + --user $(cat ~/.jenkins.ci.curoverse.com) \ + --data-urlencode json='{"parameter": [{"name":"git_hash", "value":"'$head'"}]}' -- 2.30.2