[ARVADOS] updated: 2.1.0-855-g431b8df75
Git user
git at public.arvados.org
Fri May 28 20:43:27 UTC 2021
Summary of changes:
.../token-expiration-policy.html.textile.liquid | 27 +++++++++++++++-------
lib/config/config.default.yml | 9 +++++++-
lib/config/export.go | 1 +
lib/config/generated_config.go | 9 +++++++-
sdk/go/arvados/config.go | 1 +
services/api/app/models/api_client.rb | 2 +-
.../api/app/models/api_client_authorization.rb | 4 ++--
.../api_client_authorizations_api_test.rb | 20 ++++++++--------
services/api/test/unit/api_client_test.rb | 1 +
9 files changed, 51 insertions(+), 23 deletions(-)
via 431b8df752ca99dd8aa777864f7c5ada650d0ac9 (commit)
via e6ef9eaf9ea30690a8f7108ed21b7b9e18260aef (commit)
via b42a11ea4126c176edb290abb61721000c59f0d2 (commit)
via dfdddd21774a4937154e9af7769dcd30d96d9418 (commit)
from be93d1d225ca8d4bccf08d9203d456b5d32dc07b (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit 431b8df752ca99dd8aa777864f7c5ada650d0ac9
Merge: be93d1d22 e6ef9eaf9
Author: Peter Amstutz <peter.amstutz at curii.com>
Date: Fri May 28 16:43:13 2021 -0400
Merge branch '17722-adjust-token-expiry' refs #17722
Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <peter.amstutz at curii.com>
commit e6ef9eaf9ea30690a8f7108ed21b7b9e18260aef
Author: Peter Amstutz <peter.amstutz at curii.com>
Date: Fri May 28 16:40:49 2021 -0400
17722: Tweak tests to be clearer about new behavior
Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <peter.amstutz at curii.com>
diff --git a/services/api/test/integration/api_client_authorizations_api_test.rb b/services/api/test/integration/api_client_authorizations_api_test.rb
index a366664e0..405e4bf68 100644
--- a/services/api/test/integration/api_client_authorizations_api_test.rb
+++ b/services/api/test/integration/api_client_authorizations_api_test.rb
@@ -124,7 +124,7 @@ class ApiClientAuthorizationsApiTest < ActionDispatch::IntegrationTest
end
end
- test "expires_at can be set to #{desired_expiration.nil? ? 'nil' : 'exceed the limit'} by admins when API.MaxTokenLifetime is set" do
+ test "behavior when expires_at is set to #{desired_expiration.nil? ? 'nil' : 'exceed the limit'} by admins when API.MaxTokenLifetime is set" do
Rails.configuration.API.MaxTokenLifetime = 1.hour
# Test token creation
@@ -139,15 +139,15 @@ class ApiClientAuthorizationsApiTest < ActionDispatch::IntegrationTest
headers: {'HTTP_AUTHORIZATION' => "OAuth2 #{api_client_authorizations(:admin_trustedclient).api_token}"}
assert_response 200
if desired_expiration.nil?
- assert_equal json_response['expires_at'].to_time.to_i, (db_current_time + Rails.configuration.API.MaxTokenLifetime).to_i
+ # When expires_at is nil, default to MaxTokenLifetime
+ assert_operator (json_response['expires_at'].to_time.to_i - (db_current_time + Rails.configuration.API.MaxTokenLifetime).to_i).abs, :<, 2
else
assert_equal json_response['expires_at'].to_time.to_i, desired_expiration.to_i
end
# Test token update (reverse the above behavior)
- previous_expiration = json_response['expires_at']
token_uuid = json_response['uuid']
- if previous_expiration.nil?
+ if desired_expiration.nil?
submitted_updated_expiration = db_current_time + Rails.configuration.API.MaxTokenLifetime + 1.hour
else
submitted_updated_expiration = nil
@@ -161,7 +161,7 @@ class ApiClientAuthorizationsApiTest < ActionDispatch::IntegrationTest
headers: {'HTTP_AUTHORIZATION' => "OAuth2 #{api_client_authorizations(:admin_trustedclient).api_token}"}
assert_response 200
if submitted_updated_expiration.nil?
- assert_equal json_response['expires_at'].to_time.to_i, (db_current_time + Rails.configuration.API.MaxTokenLifetime).to_i
+ assert_operator (json_response['expires_at'].to_time.to_i - (db_current_time + Rails.configuration.API.MaxTokenLifetime).to_i).abs, :<, 2
else
assert_equal json_response['expires_at'].to_time.to_i, submitted_updated_expiration.to_i
end
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list