|
23 | 23 |
|
24 | 24 | let(:response) do |
25 | 25 | { |
26 | | - body: |
27 | | - '285ec90006a6961ebcb7dd9685acc0ebcd08f561 '\ |
28 | | - 'minio.RELEASE.2021-07-08T19-43-25Z', |
| 26 | + body: '3832278ee2bb74d41b617788b4244e410b29e4a8 minio.RELEASE.2022-07-17T15-43-14Z', # rubocop:disable Layout/LineLength |
29 | 27 | status: 200 |
30 | 28 | } |
31 | 29 | end |
|
40 | 38 | end |
41 | 39 |
|
42 | 40 | let(:stdout) do |
43 | | - "minio version RELEASE.2021-07-08T19-43-25Z\n"\ |
44 | | - "commit: dd53b287f2eeed9cd3872eeae7d64696bfd7829d\n"\ |
45 | | - 'go version: go1.18.3' |
| 41 | + 'minio version RELEASE.2022-07-17T15-43-14Z (commit-id=1b339ea062b423f1c6fbeb02116d020d18418917)' # rubocop:disable Layout/LineLength |
46 | 42 | end |
47 | 43 |
|
48 | 44 | let(:stderr) { nil } |
49 | 45 | let(:success) { true } |
50 | 46 |
|
51 | 47 | context 'with matching local and remote version' do |
52 | | - it 'should be ok if versions are equal' do |
| 48 | + it 'should be ok' do |
53 | 49 | expect { check.run }.to raise_error do |error| |
54 | 50 | expect(error).to be_a SystemExit |
55 | 51 | expect(error.status).to eq 0 |
|
58 | 54 | expect(check).to have_received(:output).with( |
59 | 55 | 'No new minio version available' |
60 | 56 | ) |
| 57 | + |
61 | 58 | expect(checksum_request).to have_been_requested |
62 | 59 | end |
63 | 60 | end |
|
67 | 64 | { |
68 | 65 | body: |
69 | 66 | '285ec90006a6961ebcb7dd9685acc0ebcd08f561 '\ |
70 | | - 'minio.RELEASE.2022-07-08T19-43-25Z', |
| 67 | + 'minio.RELEASE.3022-07-17T15-43-14Z', |
71 | 68 | status: 200 |
72 | 69 | } |
73 | 70 | end |
|
79 | 76 | end |
80 | 77 |
|
81 | 78 | expect(check).to have_received(:output).with( |
82 | | - 'New minio version available RELEASE.2022-07-08T19-43-25Z' |
| 79 | + 'New minio version available RELEASE.3022-07-17T15-43-14Z' |
83 | 80 | ) |
| 81 | + |
84 | 82 | expect(checksum_request).to have_been_requested |
85 | 83 | end |
86 | 84 | end |
87 | 85 |
|
88 | 86 | context 'with unknown local version' do |
89 | | - let(:stdout) { nil } |
90 | | - let(:stderr) { 'Minio not found' } |
91 | | - let(:success) { false } |
92 | | - |
93 | | - it 'should be unknown' do |
94 | | - expect { check.run }.to raise_error do |error| |
95 | | - expect(error).to be_a SystemExit |
96 | | - expect(error.status).to eq 3 |
| 87 | + context 'when minio executable not found' do |
| 88 | + let(:stdout) { nil } |
| 89 | + let(:stderr) { 'minio not found' } |
| 90 | + let(:success) { false } |
| 91 | + |
| 92 | + it 'should be unknown' do |
| 93 | + expect { check.run }.to raise_error do |error| |
| 94 | + expect(error).to be_a SystemExit |
| 95 | + expect(error.status).to eq 3 |
| 96 | + end |
| 97 | + |
| 98 | + expect(check).to have_received(:output).with( |
| 99 | + 'Unable to gather local minio version: minio not found' |
| 100 | + ) |
| 101 | + |
| 102 | + expect(checksum_request).not_to have_been_requested |
97 | 103 | end |
| 104 | + end |
98 | 105 |
|
99 | | - expect(check).to have_received(:output).with( |
100 | | - 'Unable to gather local minio version: Minio not found' |
101 | | - ) |
102 | | - expect(checksum_request).to have_been_requested |
| 106 | + context 'when release could not be extracted' do |
| 107 | + let(:stdout) { 'INVALID' } |
| 108 | + |
| 109 | + it 'should be unknown' do |
| 110 | + expect { check.run }.to raise_error do |error| |
| 111 | + expect(error).to be_a SystemExit |
| 112 | + expect(error.status).to eq 3 |
| 113 | + end |
| 114 | + |
| 115 | + expect(check).to have_received(:output).with( |
| 116 | + 'Unable to extract release: INVALID' |
| 117 | + ) |
| 118 | + |
| 119 | + expect(checksum_request).not_to have_been_requested |
| 120 | + end |
103 | 121 | end |
104 | 122 | end |
105 | 123 |
|
106 | | - context 'with release url not found' do |
107 | | - let(:response) { { body: '404 Not Found', status: 404 } } |
| 124 | + context 'with unknown remote version' do |
| 125 | + context 'with release url not found' do |
| 126 | + let(:response) { { body: '404 Not Found', status: 404 } } |
108 | 127 |
|
109 | | - it 'should be unknown' do |
110 | | - expect { check.run }.to raise_error do |error| |
111 | | - expect(error).to be_a SystemExit |
112 | | - expect(error.status).to eq 3 |
| 128 | + it 'should be unknown' do |
| 129 | + expect { check.run }.to raise_error do |error| |
| 130 | + expect(error).to be_a SystemExit |
| 131 | + expect(error.status).to eq 3 |
| 132 | + end |
| 133 | + |
| 134 | + expect(check).to have_received(:output).with( |
| 135 | + 'Unable to gather latest minio version: 404 Not Found' |
| 136 | + ) |
| 137 | + |
| 138 | + expect(checksum_request).to have_been_requested |
113 | 139 | end |
| 140 | + end |
114 | 141 |
|
115 | | - expect(check).to have_received(:output).with( |
116 | | - 'Unable to gather latest minio version: 404 Not Found' |
117 | | - ) |
118 | | - expect(checksum_request).to have_been_requested |
| 142 | + context 'when release could not be extracted' do |
| 143 | + let(:response) do |
| 144 | + { |
| 145 | + body: '3832278ee2bb74d41b617788b4244e410b29e4a8 INVALID', |
| 146 | + status: 200 |
| 147 | + } |
| 148 | + end |
| 149 | + |
| 150 | + it 'should be unknown' do |
| 151 | + expect { check.run }.to raise_error do |error| |
| 152 | + expect(error).to be_a SystemExit |
| 153 | + expect(error.status).to eq 3 |
| 154 | + end |
| 155 | + |
| 156 | + expect(check).to have_received(:output).with( |
| 157 | + 'Unable to extract release: 3832278ee2bb74d41b617788b4244e410b29e4a8 INVALID' # rubocop:disable Layout/LineLength |
| 158 | + ) |
| 159 | + |
| 160 | + expect(checksum_request).to have_been_requested |
| 161 | + end |
119 | 162 | end |
120 | 163 | end |
121 | 164 | end |
0 commit comments