From 557b0330cdb1e594d10e53f7a5172f13595be831 Mon Sep 17 00:00:00 2001 From: Hiro Asari Date: Tue, 14 Feb 2017 15:55:00 +1100 Subject: [PATCH] Put oauth_token only when config demands it --- lib/travis/scheduler/serialize/worker.rb | 5 +++-- spec/travis/scheduler/serialize/worker_spec.rb | 6 ++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/travis/scheduler/serialize/worker.rb b/lib/travis/scheduler/serialize/worker.rb index bf368e2c..041ad916 100644 --- a/lib/travis/scheduler/serialize/worker.rb +++ b/lib/travis/scheduler/serialize/worker.rb @@ -11,7 +11,7 @@ class Worker < Struct.new(:job, :config) require 'travis/scheduler/serialize/worker/ssh_key' def data - { + value = { type: :test, vm_type: repo.vm_type, queue: job.queue, @@ -23,8 +23,9 @@ def data ssh_key: ssh_key, timeouts: repo.timeouts, cache_settings: cache_settings, - oauth_token: github_oauth_token } + value[:oauth_token] = github_oauth_token if Travis.config.prefer_https? + value end private diff --git a/spec/travis/scheduler/serialize/worker_spec.rb b/spec/travis/scheduler/serialize/worker_spec.rb index 69a3bc5b..3e0e5b23 100644 --- a/spec/travis/scheduler/serialize/worker_spec.rb +++ b/spec/travis/scheduler/serialize/worker_spec.rb @@ -89,8 +89,7 @@ def encrypted(value) hard_limit: 180 * 60, # worker handles timeouts in seconds log_silence: 20 * 60 }, - cache_settings: s3, - oauth_token: 'token' + cache_settings: s3 ) end @@ -246,8 +245,7 @@ def encrypted(value) hard_limit: 180 * 60, # worker handles timeouts in seconds log_silence: 20 * 60 }, - cache_settings: s3, - oauth_token: 'token' + cache_settings: s3 ) end