Commit aa7f984
authored
Verify content address test coverage (#186)
* Add edge case tests for Gem::ContentAddress
- test_match: add realistic SHA-256 prefix '78be552b', empty string,
non-String types (Integer, Symbol), and whitespace-padded hex
- test_content_addressed_with_eligible_spec_and_invalid_address:
eligible spec with non-hex content_address should not be
considered content-addressed
Assisted-By: devx/25d3c4be-88ab-425e-a76b-08a00d8e9d71
* Add edge case tests for gem build --ruby-abi and rename test_handle_options
- test_ruby_abi_rejects_invalid_format: '3', '3.4.1', 'abc', '3.x' raise
- test_ruby_abi_rejects_ruby_platform: no platform set raises
- test_ruby_abi_rejects_nil_platform: nil platform raises
- test_ruby_abi_rejects_mismatched_required_ruby_version: spec with
~> 3.3.0 and --ruby-abi 3.4 raises
- test_ruby_abi_defaults_required_ruby_version_when_unset: no RRV set
defaults to ~> 3.4.0, verified from built gem spec
- test_ruby_abi_with_output_raises: both --output and --ruby-abi raises
- test_ruby_abi_hash_is_deterministic: two builds produce same SHA
- Rename test_handle_options to test_handle_options_force_strict_platform
Assisted-By: devx/25d3c4be-88ab-425e-a76b-08a00d8e9d71
* Add edge case tests for gem push selectors
- test_execute_with_both_selectors_raises_when_multiple_gems_match_without_suggestion:
both selectors set, multiple matches, verifies no suggestion is appended
- test_execute_with_both_selectors_selects_single_matching_gem: single gem
matching both --platform and --ruby-abi pushes successfully
- test_execute_with_platform_selector_selects_single_non_content_addressable_gem:
single non-content-addressable gem with --platform only pushes
- test_execute_with_ruby_abi_selector_matches_source_gem: RUBY-platform gem
with ~> 3.4.0 matched by --ruby-abi, documenting ruby_matches? doesn't
check platform
- Rename fat/skinny/broad references in existing tests to
non_content_addressable and content_addressable
Assisted-By: devx/25d3c4be-88ab-425e-a76b-08a00d8e9d71
* Add tests for built CA gem spec metadata and RRV stability
- test_ruby_abi_built_gem_preserves_spec_metadata: reads back built CA gem
with Gem::Package.new(file).spec, verifies name, version, platform,
required_ruby_version, and ruby_abi are preserved
- test_required_ruby_version_unchanged_after_successful_matching_build:
builds with matching ~> 3.4.0 and --ruby-abi 3.4, asserts RRV unchanged
Assisted-By: devx/25d3c4be-88ab-425e-a76b-08a00d8e9d71
* Add cache file verification to CA installer test
- test_install_assigns_content_address_from_filename: assert the gem is
cached under the CA filename (cache/a-2-<address>.gem) in addition to
gems/ and specifications/ paths
Assisted-By: devx/25d3c4be-88ab-425e-a76b-08a00d8e9d71
* Add source gem to mixed CA and platform display test
- test_execute_remote_content_addressable_and_platform_gems_display_together:
add a source gem (version 4, RUBY platform) alongside CA and platform gems
to verify it displays as bare version without platform info
Assisted-By: devx/25d3c4be-88ab-425e-a76b-08a00d8e9d71
* Add missing CA display test cases for gem search
- test_execute_content_addressable_gems_displays_ruby_abis_next_to_their_platforms:
same version, different platforms/ABIs on separate lines
- test_execute_content_addressable_gems_displays_multiple_ruby_abis_on_the_same_line:
same version+platform, different ABIs grouped
- test_execute_content_addressable_gems_displays_multiple_versions_on_separate_lines:
multiple versions each on own line
- test_execute_platform_gem_displays_version_once_for_multiple_platforms:
platform gem with multiple platforms shows version once
- test_execute_content_addressable_platform_and_source_gems_display_together:
mixed CA, platform, and source gems display together
Assisted-By: devx/25d3c4be-88ab-425e-a76b-08a00d8e9d71
* Add missing CA display test cases for gem info
- test_execute_remote_content_addressable_gem_displays_multiple_ruby_abis_on_same_platform:
same version+platform, different ABIs grouped on one line
- test_execute_remote_content_addressable_platform_and_source_gems_display_together:
mixed CA, platform, and source gems; source gem appears in header but
not in Platforms section
- test_execute_remote_platform_gem_displays_version_once_for_multiple_platforms:
platform gem with multiple platforms uses comma-separated display format
Assisted-By: devx/25d3c4be-88ab-425e-a76b-08a00d8e9d71
* Add tests for mixed CA/platform entries and missing ruby field
- test_load_specs_compact_index_decodes_mixed_content_addressable_and_platform_entries:
versions list with both CA hash and platform suffix; verifies both returned,
CA entry has content_address and ruby_abi, platform entry does not
- test_load_specs_compact_index_content_addressable_without_ruby_field:
/info/ metadata with platform:= but no ruby: field; verifies ruby_abi is nil
while platform and content_address are still set
Assisted-By: devx/25d3c4be-88ab-425e-a76b-08a00d8e9d71
* Add CA resolver tests and rename fat to non_content_addressable
- test_prefers_compatible_content_addressed_gem_when_multiple_abis_available:
two CA gems with different ABIs, one incompatible, verifies compatible
one is selected
- test_raises_when_only_content_addressed_gem_is_incompatible: only CA gem
with incompatible required_ruby_version, no fallback, verifies
DependencyResolutionError is raised
- Rename test_falls_back_to_fat_* to test_falls_back_to_non_content_addressable_*
and fat_spec to non_content_addressable_spec
Assisted-By: devx/25d3c4be-88ab-425e-a76b-08a00d8e9d71
* Add test for ruby_abi with default required_ruby_version
- test_ruby_abi_returns_nil_for_default_required_ruby_version: a fresh
spec with default required_ruby_version (>= 0) returns nil for ruby_abi,
covering the most common case of gems without RRV
Assisted-By: devx/25d3c4be-88ab-425e-a76b-08a00d8e9d71
* Add CA spec_name and equality tests, rename fat to non_content_addressable
- test_content_addressable_spec_name: verifies spec_name uses CA suffix
(a-1-abcdef12.gemspec)
- test_content_addressable_tuples_with_different_addresses_are_distinct:
verifies == includes content_address but hash does not (based on to_a),
documenting hash collision behavior
- Rename test_fat_tuple_* to test_non_content_addressable_tuple_* and
fat/skinny variables to non_content_addressable/content_addressable
Assisted-By: devx/25d3c4be-88ab-425e-a76b-08a00d8e9d71
* Add test for all CA gems incompatible and rename fat in description
- Add test for two CA gems with different mismatched ABIs plus non-CA
platform fallback, verifies non-CA gem is installed
- Rename 'fat' to remove it from test #7 description for consistency
Assisted-By: devx/25d3c4be-88ab-425e-a76b-08a00d8e9d71
* Add test for CA gem yank with no matching ABI
- test_execute_with_ruby_abi_and_platform_no_matching_gem_displays_error:
verifies yank with both --platform and --ruby-abi sends all params to
API and displays the 404 error message from rubygems.org
Assisted-By: devx/2658d4ad-be37-4929-8dda-b1d772952c7b
* Add tests for full SHA256 content address and CA gem coexistence
- test_install_assigns_content_address_from_filename_with_full_sha:
verifies installer accepts full 64-char SHA256 as content address
- test_two_content_addressed_gems_with_same_name_version_coexist:
verifies two gems with same name/version/platform but different content
addresses install to distinct directories and gemspecs without overwriting
Assisted-By: devx/2658d4ad-be37-4929-8dda-b1d772952c7b1 parent 2f3b567 commit aa7f984
16 files changed
Lines changed: 845 additions & 35 deletions
File tree
- lib/rubygems
- commands
- spec/install/gemfile
- test/rubygems
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
170 | 170 | | |
171 | 171 | | |
172 | 172 | | |
173 | | - | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
174 | 176 | | |
175 | 177 | | |
176 | 178 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
406 | 406 | | |
407 | 407 | | |
408 | 408 | | |
| 409 | + | |
409 | 410 | | |
410 | 411 | | |
411 | 412 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
168 | 168 | | |
169 | 169 | | |
170 | 170 | | |
171 | | - | |
| 171 | + | |
172 | 172 | | |
173 | 173 | | |
174 | 174 | | |
| |||
242 | 242 | | |
243 | 243 | | |
244 | 244 | | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
245 | 337 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
| 31 | + | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| |||
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
123 | 273 | | |
124 | 274 | | |
125 | 275 | | |
| |||
0 commit comments