1 # Copyright (C) The Arvados Authors. All rights reserved.
3 # SPDX-License-Identifier: Apache-2.0
6 require "mocha/minitest"
8 class FakeError < StandardError; end
9 class RequestIdTest < Minitest::Test
10 def test_raise_exception_with_request_id
13 assert_nil clnt.request_id
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")
19 assert clnt.request_id != nil
20 assert_match /Uh-oh.*\(Request ID: req-[0-9a-zA-Z]{20}\)/, err.message