18691: Add groups.frozen_by_uuid attribute.
[arvados.git] / sdk / ruby / test / test_request_id.rb
1 # Copyright (C) The Arvados Authors. All rights reserved.
2 #
3 # SPDX-License-Identifier: Apache-2.0
4
5 require "arvados"
6 require "mocha/minitest"
7
8 class FakeError < StandardError; end
9 class RequestIdTest < Minitest::Test
10     def test_raise_exception_with_request_id
11         arv = Arvados.new
12         clnt = arv.client
13         assert_nil clnt.request_id
14
15         Google::APIClient.any_instance.stubs(:execute).raises(FakeError.new("Uh-oh..."))
16         err = assert_raises(FakeError) do
17             arv.collection.get(uuid: "zzzzz-4zz18-zzzzzzzzzzzzzzz")
18         end
19         assert clnt.request_id != nil
20         assert_match /Uh-oh.*\(Request ID: req-[0-9a-zA-Z]{20}\)/, err.message
21     end
22 end