diff --git a/lib/spack/spack/test/cmd/buildcache.py b/lib/spack/spack/test/cmd/buildcache.py index 6f3d0c17817..6cc74f5380a 100644 --- a/lib/spack/spack/test/cmd/buildcache.py +++ b/lib/spack/spack/test/cmd/buildcache.py @@ -196,7 +196,7 @@ def test_buildcache_autopush(tmp_path, install_mockery, mock_fetch): def test_buildcache_exclude(tmp_path, install_mockery, mock_fetch): - """Test buildcache with autopush""" + """Test buildcache with autopush can exclude""" mirror_dir = tmp_path / "mirror_a" mirror( @@ -213,12 +213,18 @@ def test_buildcache_exclude(tmp_path, install_mockery, mock_fetch): # Install and generate build cache index PackageInstaller([s.package], fake=True, explicit=True).install() + found_file = URLBuildcacheEntry.get_manifest_filename(s) + missing_file = URLBuildcacheEntry.get_manifest_filename(s["libelf"]) + found_dirs = os.path.join( + *URLBuildcacheEntry.get_relative_path_components(BuildcacheComponent.SPEC), s.name + ) + missing_dirs = os.path.join( + *URLBuildcacheEntry.get_relative_path_components(BuildcacheComponent.SPEC), + s["libelf"].name, + ) - missing_file = spack.binary_distribution.tarball_name(s["libelf"], ".spec.json") - found_file = spack.binary_distribution.tarball_name(s, ".spec.json") - - assert (mirror_dir / "build_cache" / found_file).exists() - assert not (mirror_dir / "build_cache" / missing_file).exists() + assert (mirror_dir / found_dirs / found_file).exists() + assert not (mirror_dir / missing_dirs / missing_file).exists() def test_buildcache_sync(