From 0739748000bf59abcdab95dee9ef2a7870d06b96 Mon Sep 17 00:00:00 2001 From: Christian Bruckmayer Date: Wed, 19 Apr 2017 11:51:19 +0200 Subject: [PATCH] [ci] Refactor #update_build_log test for multibuild package to check for the instance variable offset instead of calling the get_size function. This will make it easier to refactor in the future as it does not depend on the internal implementation anymore. --- ...propriate_arguments.yml => 1_13_2_4_1.yml} | 2 +- .../for_multibuild_package/1_13_2_4_2.yml | 40 ++++++++++ .../for_multibuild_package/1_13_2_4_3.yml | 40 ++++++++++ .../for_multibuild_package/1_13_2_4_4.yml | 40 ++++++++++ .../instance_variables/1_13_2_4_1_1.yml | 77 ------------------- .../instance_variables/1_13_2_4_1_2.yml | 77 ------------------- .../instance_variables/1_13_2_4_1_3.yml | 77 ------------------- .../webui/package_controller_spec.rb | 22 +++--- 8 files changed, 130 insertions(+), 245 deletions(-) rename src/api/spec/cassettes/Webui_PackageController/build_logs/GET_update_build_log/for_multibuild_package/{should_call_get_size_of_log_with_appropriate_arguments.yml => 1_13_2_4_1.yml} (95%) create mode 100644 src/api/spec/cassettes/Webui_PackageController/build_logs/GET_update_build_log/for_multibuild_package/1_13_2_4_2.yml create mode 100644 src/api/spec/cassettes/Webui_PackageController/build_logs/GET_update_build_log/for_multibuild_package/1_13_2_4_3.yml create mode 100644 src/api/spec/cassettes/Webui_PackageController/build_logs/GET_update_build_log/for_multibuild_package/1_13_2_4_4.yml delete mode 100644 src/api/spec/cassettes/Webui_PackageController/build_logs/GET_update_build_log/for_multibuild_package/instance_variables/1_13_2_4_1_1.yml delete mode 100644 src/api/spec/cassettes/Webui_PackageController/build_logs/GET_update_build_log/for_multibuild_package/instance_variables/1_13_2_4_1_2.yml delete mode 100644 src/api/spec/cassettes/Webui_PackageController/build_logs/GET_update_build_log/for_multibuild_package/instance_variables/1_13_2_4_1_3.yml diff --git a/src/api/spec/cassettes/Webui_PackageController/build_logs/GET_update_build_log/for_multibuild_package/should_call_get_size_of_log_with_appropriate_arguments.yml b/src/api/spec/cassettes/Webui_PackageController/build_logs/GET_update_build_log/for_multibuild_package/1_13_2_4_1.yml similarity index 95% rename from src/api/spec/cassettes/Webui_PackageController/build_logs/GET_update_build_log/for_multibuild_package/should_call_get_size_of_log_with_appropriate_arguments.yml rename to src/api/spec/cassettes/Webui_PackageController/build_logs/GET_update_build_log/for_multibuild_package/1_13_2_4_1.yml index 53b3393c524..9153e5f1f9a 100644 --- a/src/api/spec/cassettes/Webui_PackageController/build_logs/GET_update_build_log/for_multibuild_package/should_call_get_size_of_log_with_appropriate_arguments.yml +++ b/src/api/spec/cassettes/Webui_PackageController/build_logs/GET_update_build_log/for_multibuild_package/1_13_2_4_1.yml @@ -36,5 +36,5 @@ http_interactions:
404 project 'home:tom' has no repository 'leap_42.2'
http_version: - recorded_at: Wed, 19 Apr 2017 08:21:11 GMT + recorded_at: Wed, 19 Apr 2017 11:15:27 GMT recorded_with: VCR 3.0.3 diff --git a/src/api/spec/cassettes/Webui_PackageController/build_logs/GET_update_build_log/for_multibuild_package/1_13_2_4_2.yml b/src/api/spec/cassettes/Webui_PackageController/build_logs/GET_update_build_log/for_multibuild_package/1_13_2_4_2.yml new file mode 100644 index 00000000000..3615b5b790a --- /dev/null +++ b/src/api/spec/cassettes/Webui_PackageController/build_logs/GET_update_build_log/for_multibuild_package/1_13_2_4_2.yml @@ -0,0 +1,40 @@ +--- +http_interactions: +- request: + method: get + uri: http://localhost:3200/build/home:tom/leap_42.2/i586/my_package:multibuild-package/_log?end=65536&nostream=1&start=0 + body: + encoding: US-ASCII + string: '' + headers: + Content-Type: + - text/plain + Accept-Encoding: + - identity + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 404 + message: project 'home tom' has no repository 'leap_42.2' + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '174' + body: + encoding: UTF-8 + string: | + + project 'home:tom' has no repository 'leap_42.2' +
404 project 'home:tom' has no repository 'leap_42.2'
+
+ http_version: + recorded_at: Wed, 19 Apr 2017 11:15:28 GMT +recorded_with: VCR 3.0.3 diff --git a/src/api/spec/cassettes/Webui_PackageController/build_logs/GET_update_build_log/for_multibuild_package/1_13_2_4_3.yml b/src/api/spec/cassettes/Webui_PackageController/build_logs/GET_update_build_log/for_multibuild_package/1_13_2_4_3.yml new file mode 100644 index 00000000000..3615b5b790a --- /dev/null +++ b/src/api/spec/cassettes/Webui_PackageController/build_logs/GET_update_build_log/for_multibuild_package/1_13_2_4_3.yml @@ -0,0 +1,40 @@ +--- +http_interactions: +- request: + method: get + uri: http://localhost:3200/build/home:tom/leap_42.2/i586/my_package:multibuild-package/_log?end=65536&nostream=1&start=0 + body: + encoding: US-ASCII + string: '' + headers: + Content-Type: + - text/plain + Accept-Encoding: + - identity + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 404 + message: project 'home tom' has no repository 'leap_42.2' + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '174' + body: + encoding: UTF-8 + string: | + + project 'home:tom' has no repository 'leap_42.2' +
404 project 'home:tom' has no repository 'leap_42.2'
+
+ http_version: + recorded_at: Wed, 19 Apr 2017 11:15:28 GMT +recorded_with: VCR 3.0.3 diff --git a/src/api/spec/cassettes/Webui_PackageController/build_logs/GET_update_build_log/for_multibuild_package/1_13_2_4_4.yml b/src/api/spec/cassettes/Webui_PackageController/build_logs/GET_update_build_log/for_multibuild_package/1_13_2_4_4.yml new file mode 100644 index 00000000000..9153e5f1f9a --- /dev/null +++ b/src/api/spec/cassettes/Webui_PackageController/build_logs/GET_update_build_log/for_multibuild_package/1_13_2_4_4.yml @@ -0,0 +1,40 @@ +--- +http_interactions: +- request: + method: get + uri: http://localhost:3200/build/home:tom/leap_42.2/i586/my_package:multibuild-package/_log?end=65536&nostream=1&start=0 + body: + encoding: US-ASCII + string: '' + headers: + Content-Type: + - text/plain + Accept-Encoding: + - identity + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 404 + message: project 'home tom' has no repository 'leap_42.2' + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '174' + body: + encoding: UTF-8 + string: | + + project 'home:tom' has no repository 'leap_42.2' +
404 project 'home:tom' has no repository 'leap_42.2'
+
+ http_version: + recorded_at: Wed, 19 Apr 2017 11:15:27 GMT +recorded_with: VCR 3.0.3 diff --git a/src/api/spec/cassettes/Webui_PackageController/build_logs/GET_update_build_log/for_multibuild_package/instance_variables/1_13_2_4_1_1.yml b/src/api/spec/cassettes/Webui_PackageController/build_logs/GET_update_build_log/for_multibuild_package/instance_variables/1_13_2_4_1_1.yml deleted file mode 100644 index fad2a5fa1dd..00000000000 --- a/src/api/spec/cassettes/Webui_PackageController/build_logs/GET_update_build_log/for_multibuild_package/instance_variables/1_13_2_4_1_1.yml +++ /dev/null @@ -1,77 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: http://localhost:3200/build/home:tom/leap_42.2/i586/my_package:multibuild-package/_log?view=entry - body: - encoding: US-ASCII - string: '' - headers: - Content-Type: - - text/plain - Accept-Encoding: - - identity - Accept: - - "*/*" - User-Agent: - - Ruby - response: - status: - code: 404 - message: project 'home tom' has no repository 'leap_42.2' - headers: - Content-Type: - - text/xml - Cache-Control: - - no-cache - Connection: - - close - Content-Length: - - '174' - body: - encoding: UTF-8 - string: | - - project 'home:tom' has no repository 'leap_42.2' -
404 project 'home:tom' has no repository 'leap_42.2'
-
- http_version: - recorded_at: Wed, 19 Apr 2017 08:21:11 GMT -- request: - method: get - uri: http://localhost:3200/build/home:tom/leap_42.2/i586/my_package:multibuild-package/_log?end=65536&nostream=1&start=0 - body: - encoding: US-ASCII - string: '' - headers: - Content-Type: - - text/plain - Accept-Encoding: - - identity - Accept: - - "*/*" - User-Agent: - - Ruby - response: - status: - code: 404 - message: project 'home tom' has no repository 'leap_42.2' - headers: - Content-Type: - - text/xml - Cache-Control: - - no-cache - Connection: - - close - Content-Length: - - '174' - body: - encoding: UTF-8 - string: | - - project 'home:tom' has no repository 'leap_42.2' -
404 project 'home:tom' has no repository 'leap_42.2'
-
- http_version: - recorded_at: Wed, 19 Apr 2017 08:21:11 GMT -recorded_with: VCR 3.0.3 diff --git a/src/api/spec/cassettes/Webui_PackageController/build_logs/GET_update_build_log/for_multibuild_package/instance_variables/1_13_2_4_1_2.yml b/src/api/spec/cassettes/Webui_PackageController/build_logs/GET_update_build_log/for_multibuild_package/instance_variables/1_13_2_4_1_2.yml deleted file mode 100644 index a354156be57..00000000000 --- a/src/api/spec/cassettes/Webui_PackageController/build_logs/GET_update_build_log/for_multibuild_package/instance_variables/1_13_2_4_1_2.yml +++ /dev/null @@ -1,77 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: http://localhost:3200/build/home:tom/leap_42.2/i586/my_package:multibuild-package/_log?view=entry - body: - encoding: US-ASCII - string: '' - headers: - Content-Type: - - text/plain - Accept-Encoding: - - identity - Accept: - - "*/*" - User-Agent: - - Ruby - response: - status: - code: 404 - message: project 'home tom' has no repository 'leap_42.2' - headers: - Content-Type: - - text/xml - Cache-Control: - - no-cache - Connection: - - close - Content-Length: - - '174' - body: - encoding: UTF-8 - string: | - - project 'home:tom' has no repository 'leap_42.2' -
404 project 'home:tom' has no repository 'leap_42.2'
-
- http_version: - recorded_at: Wed, 19 Apr 2017 08:21:12 GMT -- request: - method: get - uri: http://localhost:3200/build/home:tom/leap_42.2/i586/my_package:multibuild-package/_log?end=65536&nostream=1&start=0 - body: - encoding: US-ASCII - string: '' - headers: - Content-Type: - - text/plain - Accept-Encoding: - - identity - Accept: - - "*/*" - User-Agent: - - Ruby - response: - status: - code: 404 - message: project 'home tom' has no repository 'leap_42.2' - headers: - Content-Type: - - text/xml - Cache-Control: - - no-cache - Connection: - - close - Content-Length: - - '174' - body: - encoding: UTF-8 - string: | - - project 'home:tom' has no repository 'leap_42.2' -
404 project 'home:tom' has no repository 'leap_42.2'
-
- http_version: - recorded_at: Wed, 19 Apr 2017 08:21:12 GMT -recorded_with: VCR 3.0.3 diff --git a/src/api/spec/cassettes/Webui_PackageController/build_logs/GET_update_build_log/for_multibuild_package/instance_variables/1_13_2_4_1_3.yml b/src/api/spec/cassettes/Webui_PackageController/build_logs/GET_update_build_log/for_multibuild_package/instance_variables/1_13_2_4_1_3.yml deleted file mode 100644 index fad2a5fa1dd..00000000000 --- a/src/api/spec/cassettes/Webui_PackageController/build_logs/GET_update_build_log/for_multibuild_package/instance_variables/1_13_2_4_1_3.yml +++ /dev/null @@ -1,77 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: http://localhost:3200/build/home:tom/leap_42.2/i586/my_package:multibuild-package/_log?view=entry - body: - encoding: US-ASCII - string: '' - headers: - Content-Type: - - text/plain - Accept-Encoding: - - identity - Accept: - - "*/*" - User-Agent: - - Ruby - response: - status: - code: 404 - message: project 'home tom' has no repository 'leap_42.2' - headers: - Content-Type: - - text/xml - Cache-Control: - - no-cache - Connection: - - close - Content-Length: - - '174' - body: - encoding: UTF-8 - string: | - - project 'home:tom' has no repository 'leap_42.2' -
404 project 'home:tom' has no repository 'leap_42.2'
-
- http_version: - recorded_at: Wed, 19 Apr 2017 08:21:11 GMT -- request: - method: get - uri: http://localhost:3200/build/home:tom/leap_42.2/i586/my_package:multibuild-package/_log?end=65536&nostream=1&start=0 - body: - encoding: US-ASCII - string: '' - headers: - Content-Type: - - text/plain - Accept-Encoding: - - identity - Accept: - - "*/*" - User-Agent: - - Ruby - response: - status: - code: 404 - message: project 'home tom' has no repository 'leap_42.2' - headers: - Content-Type: - - text/xml - Cache-Control: - - no-cache - Connection: - - close - Content-Length: - - '174' - body: - encoding: UTF-8 - string: | - - project 'home:tom' has no repository 'leap_42.2' -
404 project 'home:tom' has no repository 'leap_42.2'
-
- http_version: - recorded_at: Wed, 19 Apr 2017 08:21:11 GMT -recorded_with: VCR 3.0.3 diff --git a/src/api/spec/controllers/webui/package_controller_spec.rb b/src/api/spec/controllers/webui/package_controller_spec.rb index 72bf347276b..7f4fd018331 100644 --- a/src/api/spec/controllers/webui/package_controller_spec.rb +++ b/src/api/spec/controllers/webui/package_controller_spec.rb @@ -859,21 +859,17 @@ def do_request(params) arch: architecture.name} } - context 'instance variables' do - before do - do_request params - end - - it { expect(assigns(:log_chunk)).not_to be_nil } - it { expect(assigns(:package)).to eq("#{source_package}:multibuild-package") } - it { expect(assigns(:project)).to eq(source_project) } - end - - it "should call 'get_size_of_log' with appropriate arguments" do - expect(controller).to receive(:get_size_of_log). - with(source_project, "#{source_package}:multibuild-package", repo_leap_42_2.name, architecture.name) + before do + path = "#{CONFIG['source_url']}/build/#{source_project}/#{repo_leap_42_2}/i586/#{source_package}:multibuild-package/_log?view=entry" + body = "" + stub_request(:get, path).and_return(body: body) do_request params end + + it { expect(assigns(:log_chunk)).not_to be_nil } + it { expect(assigns(:package)).to eq("#{source_package}:multibuild-package") } + it { expect(assigns(:project)).to eq(source_project) } + it { expect(assigns(:offset)).to eq(0) } end end end