Replace magic test port 12110 with 0 (#345)

Also introduce constants for some test package SHAs
to make them easier to update.
This commit is contained in:
translatenix
2024-03-20 10:47:28 -07:00
committed by GitHub
parent 2aa60eaf1f
commit dfe85b786e
123 changed files with 469 additions and 469 deletions
+1 -1
View File
@@ -2,6 +2,6 @@ amends "pkl:Project"
dependencies { dependencies {
["birds"] { ["birds"] {
uri = "package://localhost:12110/birds@0.5.0" uri = "package://localhost:0/birds@0.5.0"
} }
} }
@@ -1132,7 +1132,7 @@ result = someLib.x
writePklFile( writePklFile(
"test.pkl", "test.pkl",
""" """
import "package://localhost:12110/birds@0.5.0#/catalog/Swallow.pkl" import "package://localhost:0/birds@0.5.0#/catalog/Swallow.pkl"
res = Swallow res = Swallow
""" """
@@ -1212,7 +1212,7 @@ result = someLib.x
writePklFile( writePklFile(
"test.pkl", "test.pkl",
""" """
import "package://localhost:12110/birds@0.5.0#/catalog/Swallow.pkl" import "package://localhost:0/birds@0.5.0#/catalog/Swallow.pkl"
res = Swallow res = Swallow
""" """
@@ -49,19 +49,19 @@ class CliPackageDownloaderTest {
), ),
packageUris = packageUris =
listOf( listOf(
PackageUri("package://localhost:12110/birds@0.5.0"), PackageUri("package://localhost:0/birds@0.5.0"),
PackageUri("package://localhost:12110/fruit@1.0.5"), PackageUri("package://localhost:0/fruit@1.0.5"),
PackageUri("package://localhost:12110/fruit@1.1.0") PackageUri("package://localhost:0/fruit@1.1.0")
), ),
noTransitive = true noTransitive = true
) )
cmd.run() cmd.run()
assertThat(tempDir.resolve("package-1/localhost:12110/birds@0.5.0/birds@0.5.0.zip")).exists() assertThat(tempDir.resolve("package-1/localhost:0/birds@0.5.0/birds@0.5.0.zip")).exists()
assertThat(tempDir.resolve("package-1/localhost:12110/birds@0.5.0/birds@0.5.0.json")).exists() assertThat(tempDir.resolve("package-1/localhost:0/birds@0.5.0/birds@0.5.0.json")).exists()
assertThat(tempDir.resolve("package-1/localhost:12110/fruit@1.0.5/fruit@1.0.5.zip")).exists() assertThat(tempDir.resolve("package-1/localhost:0/fruit@1.0.5/fruit@1.0.5.zip")).exists()
assertThat(tempDir.resolve("package-1/localhost:12110/fruit@1.0.5/fruit@1.0.5.json")).exists() assertThat(tempDir.resolve("package-1/localhost:0/fruit@1.0.5/fruit@1.0.5.json")).exists()
assertThat(tempDir.resolve("package-1/localhost:12110/fruit@1.1.0/fruit@1.1.0.zip")).exists() assertThat(tempDir.resolve("package-1/localhost:0/fruit@1.1.0/fruit@1.1.0.zip")).exists()
assertThat(tempDir.resolve("package-1/localhost:12110/fruit@1.1.0/fruit@1.1.0.json")).exists() assertThat(tempDir.resolve("package-1/localhost:0/fruit@1.1.0/fruit@1.1.0.json")).exists()
} }
@Test @Test
@@ -86,13 +86,13 @@ class CliPackageDownloaderTest {
caCertificates = listOf(FileTestUtils.selfSignedCertificate), caCertificates = listOf(FileTestUtils.selfSignedCertificate),
testPort = server.port testPort = server.port
), ),
packageUris = listOf(PackageUri("package://localhost:12110/birds@0.5.0")), packageUris = listOf(PackageUri("package://localhost:0/birds@0.5.0")),
noTransitive = true noTransitive = true
) )
cmd.run() cmd.run()
assertThat(tempDir.resolve(".my-cache/package-1/localhost:12110/birds@0.5.0/birds@0.5.0.zip")) assertThat(tempDir.resolve(".my-cache/package-1/localhost:0/birds@0.5.0/birds@0.5.0.zip"))
.exists() .exists()
assertThat(tempDir.resolve(".my-cache/package-1/localhost:12110/birds@0.5.0/birds@0.5.0.json")) assertThat(tempDir.resolve(".my-cache/package-1/localhost:0/birds@0.5.0/birds@0.5.0.json"))
.exists() .exists()
} }
@@ -108,15 +108,13 @@ class CliPackageDownloaderTest {
), ),
packageUris = packageUris =
listOf( listOf(
PackageUri( PackageUri("package://localhost:0/birds@0.5.0::sha256:${PackageServer.BIRDS_SHA}"),
"package://localhost:12110/birds@0.5.0::sha256:0a5ad2dc13f06f73f96ba94e8d01d48252bc934e2de71a837620ca0fef8a7453"
),
), ),
noTransitive = true noTransitive = true
) )
cmd.run() cmd.run()
assertThat(tempDir.resolve("package-1/localhost:12110/birds@0.5.0/birds@0.5.0.zip")).exists() assertThat(tempDir.resolve("package-1/localhost:0/birds@0.5.0/birds@0.5.0.zip")).exists()
assertThat(tempDir.resolve("package-1/localhost:12110/birds@0.5.0/birds@0.5.0.json")).exists() assertThat(tempDir.resolve("package-1/localhost:0/birds@0.5.0/birds@0.5.0.json")).exists()
} }
@Test @Test
@@ -131,18 +129,18 @@ class CliPackageDownloaderTest {
), ),
packageUris = packageUris =
listOf( listOf(
PackageUri("package://localhost:12110/birds@0.5.0::sha256:intentionallyBogusChecksum"), PackageUri("package://localhost:0/birds@0.5.0::sha256:intentionallyBogusChecksum"),
), ),
noTransitive = true noTransitive = true
) )
assertThatCode { cmd.run() } assertThatCode { cmd.run() }
.hasMessage( .hasMessage(
""" """
Cannot download package `package://localhost:12110/birds@0.5.0` because the computed checksum for package metadata does not match the expected checksum. Cannot download package `package://localhost:0/birds@0.5.0` because the computed checksum for package metadata does not match the expected checksum.
Computed checksum: "0a5ad2dc13f06f73f96ba94e8d01d48252bc934e2de71a837620ca0fef8a7453" Computed checksum: "${PackageServer.BIRDS_SHA}"
Expected checksum: "intentionallyBogusChecksum" Expected checksum: "intentionallyBogusChecksum"
Asset URL: "https://localhost:12110/birds@0.5.0" Asset URL: "https://localhost:0/birds@0.5.0"
""" """
.trimIndent() .trimIndent()
) )
@@ -153,7 +151,7 @@ class CliPackageDownloaderTest {
val cmd = val cmd =
CliPackageDownloader( CliPackageDownloader(
baseOptions = CliBaseOptions(workingDir = tempDir, noCache = true), baseOptions = CliBaseOptions(workingDir = tempDir, noCache = true),
packageUris = listOf(PackageUri("package://localhost:12110/birds@0.5.0")), packageUris = listOf(PackageUri("package://localhost:0/birds@0.5.0")),
noTransitive = true noTransitive = true
) )
assertThatCode { cmd.run() } assertThatCode { cmd.run() }
@@ -170,12 +168,12 @@ class CliPackageDownloaderTest {
caCertificates = listOf(FileTestUtils.selfSignedCertificate), caCertificates = listOf(FileTestUtils.selfSignedCertificate),
testPort = server.port testPort = server.port
), ),
packageUris = listOf(PackageUri("package://localhost:12110/badChecksum@1.0.0")), packageUris = listOf(PackageUri("package://localhost:0/badChecksum@1.0.0")),
noTransitive = true noTransitive = true
) )
assertThatCode { cmd.run() } assertThatCode { cmd.run() }
.hasMessageStartingWith( .hasMessageStartingWith(
"Cannot download package `package://localhost:12110/badChecksum@1.0.0` because the computed checksum does not match the expected checksum." "Cannot download package `package://localhost:0/badChecksum@1.0.0` because the computed checksum does not match the expected checksum."
) )
} }
@@ -191,7 +189,7 @@ class CliPackageDownloaderTest {
), ),
packageUris = packageUris =
listOf( listOf(
PackageUri("package://localhost:12110/badChecksum@1.0.0"), PackageUri("package://localhost:0/badChecksum@1.0.0"),
PackageUri("package://bogus.domain/notAPackage@1.0.0") PackageUri("package://bogus.domain/notAPackage@1.0.0")
), ),
noTransitive = true noTransitive = true
@@ -201,12 +199,12 @@ class CliPackageDownloaderTest {
""" """
Failed to download some packages. Failed to download some packages.
Failed to download package://localhost:12110/badChecksum@1.0.0 because: Failed to download package://localhost:0/badChecksum@1.0.0 because:
Cannot download package `package://localhost:12110/badChecksum@1.0.0` because the computed checksum does not match the expected checksum. Cannot download package `package://localhost:0/badChecksum@1.0.0` because the computed checksum does not match the expected checksum.
Computed checksum: "a6bf858cdd1c09da475c2abe50525902580910ee5cc1ff624999170591bf8f69" Computed checksum: "a6bf858cdd1c09da475c2abe50525902580910ee5cc1ff624999170591bf8f69"
Expected checksum: "intentionally bogus checksum" Expected checksum: "intentionally bogus checksum"
Asset URL: "https://localhost:12110/badChecksum@1.0.0/badChecksum@1.0.0.zip" Asset URL: "https://localhost:0/badChecksum@1.0.0/badChecksum@1.0.0.zip"
Failed to download package://bogus.domain/notAPackage@1.0.0 because: Failed to download package://bogus.domain/notAPackage@1.0.0 because:
Exception when making request `GET https://bogus.domain/notAPackage@1.0.0`: Exception when making request `GET https://bogus.domain/notAPackage@1.0.0`:
@@ -226,13 +224,13 @@ class CliPackageDownloaderTest {
caCertificates = listOf(FileTestUtils.selfSignedCertificate), caCertificates = listOf(FileTestUtils.selfSignedCertificate),
testPort = server.port testPort = server.port
), ),
packageUris = listOf(PackageUri("package://localhost:12110/birds@0.5.0")), packageUris = listOf(PackageUri("package://localhost:0/birds@0.5.0")),
noTransitive = false noTransitive = false
) )
.run() .run()
assertThat(tempDir.resolve("package-1/localhost:12110/birds@0.5.0/birds@0.5.0.zip")).exists() assertThat(tempDir.resolve("package-1/localhost:0/birds@0.5.0/birds@0.5.0.zip")).exists()
assertThat(tempDir.resolve("package-1/localhost:12110/birds@0.5.0/birds@0.5.0.json")).exists() assertThat(tempDir.resolve("package-1/localhost:0/birds@0.5.0/birds@0.5.0.json")).exists()
assertThat(tempDir.resolve("package-1/localhost:12110/fruit@1.0.5/fruit@1.0.5.zip")).exists() assertThat(tempDir.resolve("package-1/localhost:0/fruit@1.0.5/fruit@1.0.5.zip")).exists()
assertThat(tempDir.resolve("package-1/localhost:12110/fruit@1.0.5/fruit@1.0.5.json")).exists() assertThat(tempDir.resolve("package-1/localhost:0/fruit@1.0.5/fruit@1.0.5.json")).exists()
} }
} }
@@ -224,7 +224,7 @@ class CliProjectPackagerTest {
dependencies { dependencies {
["birds"] { ["birds"] {
uri = "package://localhost:12110/birds@0.5.0" uri = "package://localhost:0/birds@0.5.0"
} }
} }
""" """
@@ -237,18 +237,18 @@ class CliProjectPackagerTest {
{ {
"schemaVersion": 1, "schemaVersion": 1,
"resolvedDependencies": { "resolvedDependencies": {
"package://localhost:12110/birds@0": { "package://localhost:0/birds@0": {
"type": "remote", "type": "remote",
"uri": "projectpackage://localhost:12110/birds@0.5.0", "uri": "projectpackage://localhost:0/birds@0.5.0",
"checksums": { "checksums": {
"sha256": "04eec465b217fb9779489525d26e9b587e5e47ff4d584c7673a450109715bc31" "sha256": "04eec465b217fb9779489525d26e9b587e5e47ff4d584c7673a450109715bc31"
} }
}, },
"package://localhost:12110/fruit@1": { "package://localhost:0/fruit@1": {
"type": "remote", "type": "remote",
"uri": "projectpackage://localhost:12110/fruit@1.0.5", "uri": "projectpackage://localhost:0/fruit@1.0.5",
"checksums": { "checksums": {
"sha256": "abd173e8a25f5b930b0e34269a441e32c9d95e0b0a715bc6eff918f0afd0688e" "sha256": "${PackageServer.FRUIT_SHA}"
} }
} }
} }
@@ -433,7 +433,7 @@ class CliProjectPackagerTest {
dependencies { dependencies {
["birds"] { ["birds"] {
uri = "package://localhost:12110/birds@0.5.0" uri = "package://localhost:0/birds@0.5.0"
} }
["project2"] = import("../project2/PklProject") ["project2"] = import("../project2/PklProject")
} }
@@ -446,16 +446,16 @@ class CliProjectPackagerTest {
{ {
"schemaVersion": 1, "schemaVersion": 1,
"resolvedDependencies": { "resolvedDependencies": {
"package://localhost:12110/birds@0": { "package://localhost:0/birds@0": {
"type": "remote", "type": "remote",
"uri": "projectpackage://localhost:12110/birds@0.5.0", "uri": "projectpackage://localhost:0/birds@0.5.0",
"checksums": { "checksums": {
"sha256": "3f19ab9fcee2f44f93a75a09e531db278c6d2cd25206836c8c2c4071cd7d3118" "sha256": "${PackageServer.BIRDS_SHA}"
} }
}, },
"package://localhost:12110/project2@5": { "package://localhost:0/project2@5": {
"type": "local", "type": "local",
"uri": "projectpackage://localhost:12110/project2@5.0.0", "uri": "projectpackage://localhost:0/project2@5.0.0",
"path": "../project2" "path": "../project2"
} }
} }
@@ -471,7 +471,7 @@ class CliProjectPackagerTest {
package { package {
name = "project2" name = "project2"
baseUri = "package://localhost:12110/project2" baseUri = "package://localhost:0/project2"
version = "5.0.0" version = "5.0.0"
packageZipUrl = "https://foo.com/project2.zip" packageZipUrl = "https://foo.com/project2.zip"
} }
@@ -513,15 +513,15 @@ class CliProjectPackagerTest {
}, },
"dependencies": { "dependencies": {
"birds": { "birds": {
"uri": "package://localhost:12110/birds@0.5.0", "uri": "package://localhost:0/birds@0.5.0",
"checksums": { "checksums": {
"sha256": "3f19ab9fcee2f44f93a75a09e531db278c6d2cd25206836c8c2c4071cd7d3118" "sha256": "${PackageServer.BIRDS_SHA}"
} }
}, },
"project2": { "project2": {
"uri": "package://localhost:12110/project2@5.0.0", "uri": "package://localhost:0/project2@5.0.0",
"checksums": { "checksums": {
"sha256": "6f469b28f8b62a8a1191e2749bcf9c27dedbbb1e0ea754ac34af57b534e0ddda" "sha256": "981787869571330b2f609a94a5912466990ce00e3fa94e7f290c2f99a6d5e5ed"
} }
} }
}, },
@@ -537,7 +537,7 @@ class CliProjectPackagerTest {
""" """
{ {
"name": "project2", "name": "project2",
"packageUri": "package://localhost:12110/project2@5.0.0", "packageUri": "package://localhost:0/project2@5.0.0",
"version": "5.0.0", "version": "5.0.0",
"packageZipUrl": "https://foo.com/project2.zip", "packageZipUrl": "https://foo.com/project2.zip",
"packageZipChecksums": { "packageZipChecksums": {
@@ -571,7 +571,7 @@ class CliProjectPackagerTest {
dependencies { dependencies {
["birds"] { ["birds"] {
uri = "package://localhost:12110/birds@0.5.0" uri = "package://localhost:0/birds@0.5.0"
} }
["project2"] = import("../project2/PklProject") ["project2"] = import("../project2/PklProject")
} }
@@ -584,16 +584,16 @@ class CliProjectPackagerTest {
{ {
"schemaVersion": 1, "schemaVersion": 1,
"resolvedDependencies": { "resolvedDependencies": {
"package://localhost:12110/birds@0": { "package://localhost:0/birds@0": {
"type": "remote", "type": "remote",
"uri": "projectpackage://localhost:12110/birds@0.5.0", "uri": "projectpackage://localhost:0/birds@0.5.0",
"checksums": { "checksums": {
"sha256": "3f19ab9fcee2f44f93a75a09e531db278c6d2cd25206836c8c2c4071cd7d3118" "sha256": "3f19ab9fcee2f44f93a75a09e531db278c6d2cd25206836c8c2c4071cd7d3118"
} }
}, },
"package://localhost:12110/project2@5": { "package://localhost:0/project2@5": {
"type": "local", "type": "local",
"uri": "projectpackage://localhost:12110/project2@5.0.0", "uri": "projectpackage://localhost:0/project2@5.0.0",
"path": "../project2" "path": "../project2"
} }
} }
@@ -609,7 +609,7 @@ class CliProjectPackagerTest {
package { package {
name = "project2" name = "project2"
baseUri = "package://localhost:12110/project2" baseUri = "package://localhost:0/project2"
version = "5.0.0" version = "5.0.0"
packageZipUrl = "https://foo.com/project2.zip" packageZipUrl = "https://foo.com/project2.zip"
} }
@@ -884,14 +884,14 @@ class CliProjectPackagerTest {
tempDir.writeFile("project/main.pkl", "res = 1") tempDir.writeFile("project/main.pkl", "res = 1")
tempDir.writeFile( tempDir.writeFile(
"project/PklProject", "project/PklProject",
// intentionally conflict with localhost:12110/birds@0.5.0 from our test fixtures // intentionally conflict with localhost:0/birds@0.5.0 from our test fixtures
""" """
amends "pkl:Project" amends "pkl:Project"
package { package {
name = "birds" name = "birds"
version = "0.5.0" version = "0.5.0"
baseUri = "package://localhost:12110/birds" baseUri = "package://localhost:0/birds"
packageZipUrl = "https://foo.com" packageZipUrl = "https://foo.com"
} }
""" """
@@ -916,10 +916,10 @@ class CliProjectPackagerTest {
assertThat(e) assertThat(e)
.hasMessageStartingWith( .hasMessageStartingWith(
""" """
Package `package://localhost:12110/birds@0.5.0` was already published with different contents. Package `package://localhost:0/birds@0.5.0` was already published with different contents.
Computed checksum: 04eec465b217fb9779489525d26e9b587e5e47ff4d584c7673a450109715bc31 Computed checksum: aa8c883841db22e92794f4708b01dc905b5da77645b7dfb5b22a73da8c347db1
Published checksum: 0a5ad2dc13f06f73f96ba94e8d01d48252bc934e2de71a837620ca0fef8a7453 Published checksum: ${PackageServer.BIRDS_SHA}
""" """
.trimIndent() .trimIndent()
) )
@@ -936,7 +936,7 @@ class CliProjectPackagerTest {
package { package {
name = "mangos" name = "mangos"
version = "1.0.0" version = "1.0.0"
baseUri = "package://localhost:12110/mangos" baseUri = "package://localhost:0/mangos"
packageZipUrl = "https://foo.com" packageZipUrl = "https://foo.com"
} }
""" """
@@ -73,7 +73,7 @@ class CliProjectResolverTest {
dependencies { dependencies {
["birds"] { ["birds"] {
uri = "package://localhost:12110/birds@0.5.0" uri = "package://localhost:0/birds@0.5.0"
} }
} }
""" """
@@ -98,18 +98,18 @@ class CliProjectResolverTest {
{ {
"schemaVersion": 1, "schemaVersion": 1,
"resolvedDependencies": { "resolvedDependencies": {
"package://localhost:12110/birds@0": { "package://localhost:0/birds@0": {
"type": "remote", "type": "remote",
"uri": "projectpackage://localhost:12110/birds@0.5.0", "uri": "projectpackage://localhost:0/birds@0.5.0",
"checksums": { "checksums": {
"sha256": "0a5ad2dc13f06f73f96ba94e8d01d48252bc934e2de71a837620ca0fef8a7453" "sha256": "${PackageServer.BIRDS_SHA}"
} }
}, },
"package://localhost:12110/fruit@1": { "package://localhost:0/fruit@1": {
"type": "remote", "type": "remote",
"uri": "projectpackage://localhost:12110/fruit@1.0.5", "uri": "projectpackage://localhost:0/fruit@1.0.5",
"checksums": { "checksums": {
"sha256": "abd173e8a25f5b930b0e34269a441e32c9d95e0b0a715bc6eff918f0afd0688e" "sha256": "${PackageServer.FRUIT_SHA}"
} }
} }
} }
@@ -128,7 +128,7 @@ class CliProjectResolverTest {
dependencies { dependencies {
["birds"] { ["birds"] {
uri = "package://localhost:12110/birds@0.5.0" uri = "package://localhost:0/birds@0.5.0"
} }
} }
""" """
@@ -153,18 +153,18 @@ class CliProjectResolverTest {
{ {
"schemaVersion": 1, "schemaVersion": 1,
"resolvedDependencies": { "resolvedDependencies": {
"package://localhost:12110/birds@0": { "package://localhost:0/birds@0": {
"type": "remote", "type": "remote",
"uri": "projectpackage://localhost:12110/birds@0.5.0", "uri": "projectpackage://localhost:0/birds@0.5.0",
"checksums": { "checksums": {
"sha256": "0a5ad2dc13f06f73f96ba94e8d01d48252bc934e2de71a837620ca0fef8a7453" "sha256": "${PackageServer.BIRDS_SHA}"
} }
}, },
"package://localhost:12110/fruit@1": { "package://localhost:0/fruit@1": {
"type": "remote", "type": "remote",
"uri": "projectpackage://localhost:12110/fruit@1.0.5", "uri": "projectpackage://localhost:0/fruit@1.0.5",
"checksums": { "checksums": {
"sha256": "abd173e8a25f5b930b0e34269a441e32c9d95e0b0a715bc6eff918f0afd0688e" "sha256": "${PackageServer.FRUIT_SHA}"
} }
} }
} }
@@ -184,7 +184,7 @@ class CliProjectResolverTest {
dependencies { dependencies {
["birds"] { ["birds"] {
uri = "package://localhost:12110/birds@0.5.0" uri = "package://localhost:0/birds@0.5.0"
} }
["project2"] = import("../project2/PklProject") ["project2"] = import("../project2/PklProject")
} }
@@ -198,14 +198,14 @@ class CliProjectResolverTest {
package { package {
name = "project2" name = "project2"
baseUri = "package://localhost:12110/package2" baseUri = "package://localhost:0/package2"
version = "5.0.0" version = "5.0.0"
packageZipUrl = "https://foo.com/package2.zip" packageZipUrl = "https://foo.com/package2.zip"
} }
dependencies { dependencies {
["fruit"] { ["fruit"] {
uri = "package://localhost:12110/fruit@1.0.5" uri = "package://localhost:0/fruit@1.0.5"
} }
["project3"] = import("../project3/PklProject") ["project3"] = import("../project3/PklProject")
} }
@@ -220,14 +220,14 @@ class CliProjectResolverTest {
package { package {
name = "project3" name = "project3"
baseUri = "package://localhost:12110/package3" baseUri = "package://localhost:0/package3"
version = "5.0.0" version = "5.0.0"
packageZipUrl = "https://foo.com/package3.zip" packageZipUrl = "https://foo.com/package3.zip"
} }
dependencies { dependencies {
["fruit"] { ["fruit"] {
uri = "package://localhost:12110/fruit@1.1.0" uri = "package://localhost:0/fruit@1.1.0"
} }
} }
""" """
@@ -251,28 +251,28 @@ class CliProjectResolverTest {
{ {
"schemaVersion": 1, "schemaVersion": 1,
"resolvedDependencies": { "resolvedDependencies": {
"package://localhost:12110/birds@0": { "package://localhost:0/birds@0": {
"type": "remote", "type": "remote",
"uri": "projectpackage://localhost:12110/birds@0.5.0", "uri": "projectpackage://localhost:0/birds@0.5.0",
"checksums": { "checksums": {
"sha256": "0a5ad2dc13f06f73f96ba94e8d01d48252bc934e2de71a837620ca0fef8a7453" "sha256": "${PackageServer.BIRDS_SHA}"
} }
}, },
"package://localhost:12110/fruit@1": { "package://localhost:0/fruit@1": {
"type": "remote", "type": "remote",
"uri": "projectpackage://localhost:12110/fruit@1.1.0", "uri": "projectpackage://localhost:0/fruit@1.1.0",
"checksums": { "checksums": {
"sha256": "a82e92e0c259591111d09d18a14f5ad66e2b6e13d827ee3e6f7ce06f5d0fbe0c" "sha256": "${PackageServer.FRUIT_1_1_SHA}"
} }
}, },
"package://localhost:12110/package2@5": { "package://localhost:0/package2@5": {
"type": "local", "type": "local",
"uri": "projectpackage://localhost:12110/package2@5.0.0", "uri": "projectpackage://localhost:0/package2@5.0.0",
"path": "../project2" "path": "../project2"
}, },
"package://localhost:12110/package3@5": { "package://localhost:0/package3@5": {
"type": "local", "type": "local",
"uri": "projectpackage://localhost:12110/package3@5.0.0", "uri": "projectpackage://localhost:0/package3@5.0.0",
"path": "../project3" "path": "../project3"
} }
} }
@@ -292,7 +292,7 @@ class CliProjectResolverTest {
dependencies { dependencies {
["birds"] { ["birds"] {
uri = "package://localhost:12110/birds@0.5.0" uri = "package://localhost:0/birds@0.5.0"
} }
["fruit"] = import("../fruit/PklProject") ["fruit"] = import("../fruit/PklProject")
} }
@@ -306,7 +306,7 @@ class CliProjectResolverTest {
package { package {
name = "fruit" name = "fruit"
baseUri = "package://localhost:12110/fruit" baseUri = "package://localhost:0/fruit"
version = "1.0.0" version = "1.0.0"
packageZipUrl = "https://foo.com/fruit.zip" packageZipUrl = "https://foo.com/fruit.zip"
} }
@@ -333,18 +333,18 @@ class CliProjectResolverTest {
{ {
"schemaVersion": 1, "schemaVersion": 1,
"resolvedDependencies": { "resolvedDependencies": {
"package://localhost:12110/birds@0": { "package://localhost:0/birds@0": {
"type": "remote", "type": "remote",
"uri": "projectpackage://localhost:12110/birds@0.5.0", "uri": "projectpackage://localhost:0/birds@0.5.0",
"checksums": { "checksums": {
"sha256": "0a5ad2dc13f06f73f96ba94e8d01d48252bc934e2de71a837620ca0fef8a7453" "sha256": "${PackageServer.BIRDS_SHA}"
} }
}, },
"package://localhost:12110/fruit@1": { "package://localhost:0/fruit@1": {
"type": "remote", "type": "remote",
"uri": "projectpackage://localhost:12110/fruit@1.0.5", "uri": "projectpackage://localhost:0/fruit@1.0.5",
"checksums": { "checksums": {
"sha256": "abd173e8a25f5b930b0e34269a441e32c9d95e0b0a715bc6eff918f0afd0688e" "sha256": "${PackageServer.FRUIT_SHA}"
} }
} }
} }
@@ -354,7 +354,7 @@ class CliProjectResolverTest {
) )
assertThat(errOut.toString()) assertThat(errOut.toString())
.isEqualTo( .isEqualTo(
"WARN: local dependency `package://localhost:12110/fruit@1.0.0` was overridden to remote dependency `package://localhost:12110/fruit@1.0.5`.\n" "WARN: local dependency `package://localhost:0/fruit@1.0.0` was overridden to remote dependency `package://localhost:0/fruit@1.0.5`.\n"
) )
} }
@@ -367,7 +367,7 @@ class CliProjectResolverTest {
dependencies { dependencies {
["birds"] { ["birds"] {
uri = "package://localhost:12110/birds@0.5.0" uri = "package://localhost:0/birds@0.5.0"
} }
} }
""" """
@@ -381,7 +381,7 @@ class CliProjectResolverTest {
dependencies { dependencies {
["fruit"] { ["fruit"] {
uri = "package://localhost:12110/fruit@1.1.0" uri = "package://localhost:0/fruit@1.1.0"
} }
} }
""" """
@@ -416,18 +416,18 @@ class CliProjectResolverTest {
{ {
"schemaVersion": 1, "schemaVersion": 1,
"resolvedDependencies": { "resolvedDependencies": {
"package://localhost:12110/birds@0": { "package://localhost:0/birds@0": {
"type": "remote", "type": "remote",
"uri": "projectpackage://localhost:12110/birds@0.5.0", "uri": "projectpackage://localhost:0/birds@0.5.0",
"checksums": { "checksums": {
"sha256": "0a5ad2dc13f06f73f96ba94e8d01d48252bc934e2de71a837620ca0fef8a7453" "sha256": "${PackageServer.BIRDS_SHA}"
} }
}, },
"package://localhost:12110/fruit@1": { "package://localhost:0/fruit@1": {
"type": "remote", "type": "remote",
"uri": "projectpackage://localhost:12110/fruit@1.0.5", "uri": "projectpackage://localhost:0/fruit@1.0.5",
"checksums": { "checksums": {
"sha256": "abd173e8a25f5b930b0e34269a441e32c9d95e0b0a715bc6eff918f0afd0688e" "sha256": "${PackageServer.FRUIT_SHA}"
} }
} }
} }
@@ -441,11 +441,11 @@ class CliProjectResolverTest {
{ {
"schemaVersion": 1, "schemaVersion": 1,
"resolvedDependencies": { "resolvedDependencies": {
"package://localhost:12110/fruit@1": { "package://localhost:0/fruit@1": {
"type": "remote", "type": "remote",
"uri": "projectpackage://localhost:12110/fruit@1.1.0", "uri": "projectpackage://localhost:0/fruit@1.1.0",
"checksums": { "checksums": {
"sha256": "a82e92e0c259591111d09d18a14f5ad66e2b6e13d827ee3e6f7ce06f5d0fbe0c" "sha256": "${PackageServer.FRUIT_1_1_SHA}"
} }
} }
} }
@@ -114,8 +114,8 @@ data class CliBaseOptions(
val testMode: Boolean = false, val testMode: Boolean = false,
/** /**
* Unless -1, rewrites HTTP requests that specify port 12110 to the given port. This is an * Unless -1, rewrites HTTP requests that specify port 0 to the given port. This is an internal
* internal test option. * test option.
*/ */
val testPort: Int = -1, val testPort: Int = -1,
@@ -1,8 +1,8 @@
{ {
"schemaVersion": 1, "schemaVersion": 1,
"packageUri": "package://localhost:12110/badChecksum@1.0.0", "packageUri": "package://localhost:0/badChecksum@1.0.0",
"name": "bugs", "name": "bugs",
"packageZipUrl": "https://localhost:12110/badChecksum@1.0.0/badChecksum@1.0.0.zip", "packageZipUrl": "https://localhost:0/badChecksum@1.0.0/badChecksum@1.0.0.zip",
"dependencies": {}, "dependencies": {},
"version": "1.0.0", "version": "1.0.0",
"packageZipChecksums": { "packageZipChecksums": {
@@ -1,8 +1,8 @@
{ {
"schemaVersion": 1, "schemaVersion": 1,
"packageUri": "package://localhost:12110/badImportsWithinPackage@1.1.0", "packageUri": "package://localhost:0/badImportsWithinPackage@1.1.0",
"name": "badImportsWithinPackage", "name": "badImportsWithinPackage",
"packageZipUrl": "https://localhost:12110/badImportsWithinPackage@1.0.0/badImportsWithinPackage@1.0.0.zip", "packageZipUrl": "https://localhost:0/badImportsWithinPackage@1.0.0/badImportsWithinPackage@1.0.0.zip",
"dependencies": {}, "dependencies": {},
"version": "1.0.0", "version": "1.0.0",
"packageZipChecksums": { "packageZipChecksums": {
@@ -1,6 +1,6 @@
{ {
"schemaVersion": 1, "schemaVersion": 1,
"packageUri": "package://localhost:12110/badPackagezipUrl@1.1.0", "packageUri": "package://localhost:0/badPackagezipUrl@1.1.0",
"name": "bugs", "name": "bugs",
"packageZipUrl": "ftp://wait/a/minute", "packageZipUrl": "ftp://wait/a/minute",
"dependencies": {}, "dependencies": {},
@@ -1,13 +1,13 @@
{ {
"schemaVersion": 1, "schemaVersion": 1,
"name": "birds", "name": "birds",
"packageUri": "package://localhost:12110/birds@0.5.0", "packageUri": "package://localhost:0/birds@0.5.0",
"packageZipUrl": "https://localhost:12110/birds@0.5.0/birds@0.5.0.zip", "packageZipUrl": "https://localhost:0/birds@0.5.0/birds@0.5.0.zip",
"dependencies": { "dependencies": {
"fruities": { "fruities": {
"uri": "package://localhost:12110/fruit@1.0.5", "uri": "package://localhost:0/fruit@1.0.5",
"checksums": { "checksums": {
"sha256": "abd173e8a25f5b930b0e34269a441e32c9d95e0b0a715bc6eff918f0afd0688e" "sha256": "34a15b02346e6acb85da5bd71d8b0738a79008b38a7fc805e5869d9129ad27d2"
} }
} }
}, },
@@ -1,9 +1,9 @@
{ {
"schemaVersion": 1, "schemaVersion": 1,
"packageUri": "package://localhost:12110/fruit@1.0.5", "packageUri": "package://localhost:0/fruit@1.0.5",
"name": "fruit", "name": "fruit",
"version": "1.0.5", "version": "1.0.5",
"packageZipUrl": "https://localhost:12110/fruit@1.0.5/fruit@1.0.5.zip", "packageZipUrl": "https://localhost:0/fruit@1.0.5/fruit@1.0.5.zip",
"dependencies": {}, "dependencies": {},
"packageZipChecksums": { "packageZipChecksums": {
"sha256": "$computedChecksum" "sha256": "$computedChecksum"
@@ -1,9 +1,9 @@
{ {
"schemaVersion": 1, "schemaVersion": 1,
"packageUri": "package://localhost:12110/fruit@1.1.0", "packageUri": "package://localhost:0/fruit@1.1.0",
"name": "fruit", "name": "fruit",
"version": "1.1.0", "version": "1.1.0",
"packageZipUrl": "https://localhost:12110/fruit@1.1.0/fruit@1.1.0.zip", "packageZipUrl": "https://localhost:0/fruit@1.1.0/fruit@1.1.0.zip",
"dependencies": {}, "dependencies": {},
"packageZipChecksums": { "packageZipChecksums": {
"sha256": "$computedChecksum" "sha256": "$computedChecksum"
@@ -1,9 +1,9 @@
{ {
"schemaVersion": 1, "schemaVersion": 1,
"packageUri": "package://localhost:12110/packageContainingWildcardCharacters@1.0.0", "packageUri": "package://localhost:0/packageContainingWildcardCharacters@1.0.0",
"name": "packageContainingWildcardCharacters", "name": "packageContainingWildcardCharacters",
"version": "1.0.0", "version": "1.0.0",
"packageZipUrl": "https://localhost:12110/packageContainingWildcardCharacters@1.0.0/packageContainingWildcardCharacters@1.0.0.zip", "packageZipUrl": "https://localhost:0/packageContainingWildcardCharacters@1.0.0/packageContainingWildcardCharacters@1.0.0.zip",
"dependencies": {}, "dependencies": {},
"packageZipChecksums": { "packageZipChecksums": {
"sha256": "$computedChecksum" "sha256": "$computedChecksum"
@@ -41,11 +41,15 @@ import org.pkl.commons.deleteRecursively
* * `testPort` Gradle property * * `testPort` Gradle property
* *
* If the server isn't already running, it is automatically started. * If the server isn't already running, it is automatically started.
* 4. Use port `12110` in your test. `HttpClient` will replace this port with the server port. * 4. Use port `0` in your test. `HttpClient` will replace this port with the server port.
* 4. [Close][close] the server, for example in [AfterAll][org.junit.jupiter.api.AfterAll]. * 4. [Close][close] the server, for example in [AfterAll][org.junit.jupiter.api.AfterAll].
*/ */
class PackageServer : AutoCloseable { class PackageServer : AutoCloseable {
companion object { companion object {
const val BIRDS_SHA = "bfaf5281613d170a740505cc87561041f4e0cad1f0e6938bf94f7609f9a4673d"
const val FRUIT_SHA = "34a15b02346e6acb85da5bd71d8b0738a79008b38a7fc805e5869d9129ad27d2"
const val FRUIT_1_1_SHA = "8d982761d182f2185e4180c82190791d9a60c721cb3393bb2e946fab90131e8c"
fun populateCacheDir(cacheDir: Path) { fun populateCacheDir(cacheDir: Path) {
val basePath = cacheDir.resolve("package-1/localhost:$PORT") val basePath = cacheDir.resolve("package-1/localhost:$PORT")
basePath.deleteRecursively() basePath.deleteRecursively()
@@ -65,7 +69,7 @@ class PackageServer : AutoCloseable {
// Port declared in tests. // Port declared in tests.
// Modified by RequestRewritingClient if testPort is set. // Modified by RequestRewritingClient if testPort is set.
private const val PORT = 12110 private const val PORT = 0
private val packagesDir: Path = private val packagesDir: Path =
FileTestUtils.rootProjectDir.resolve("pkl-commons-test/build/test-packages") FileTestUtils.rootProjectDir.resolve("pkl-commons-test/build/test-packages")
@@ -111,8 +111,8 @@ public interface HttpClient extends AutoCloseable {
/** /**
* Sets a test server's listening port. * Sets a test server's listening port.
* *
* <p>If set, requests that specify port 12110 will be modified to use the given port. This is * <p>If set, requests that specify port 0 will be modified to use the given port. This is an
* an internal test option. * internal test option.
*/ */
Builder setTestPort(int port); Builder setTestPort(int port);
@@ -105,9 +105,7 @@ final class RequestRewritingClient implements HttpClient {
} }
private URI rewriteUri(URI uri) { private URI rewriteUri(URI uri) {
// Would be nice to use port 0 instead of 12110, if (testPort != -1 && uri.getPort() == 0) {
// but this is best done in a separate commit.
if (testPort != -1 && uri.getPort() == 12110) {
return HttpUtils.setPort(uri, testPort); return HttpUtils.setPort(uri, testPort);
} }
return uri; return uri;
@@ -52,16 +52,16 @@ examples {
} }
["package"] { ["package"] {
import*("package://localhost:12110/birds@0.5.0#/catalog/*.pkl") import*("package://localhost:0/birds@0.5.0#/catalog/*.pkl")
import*("package://localhost:12110/birds@0.5.0#/**.pkl").keys.toListing() import*("package://localhost:0/birds@0.5.0#/**.pkl").keys.toListing()
} }
["globbing with absolute URIs and percent encoding"] { ["globbing with absolute URIs and percent encoding"] {
import*("package://localhost:12110/packageContainingWildcardCharacters@1.0.0#/name%20*") import*("package://localhost:0/packageContainingWildcardCharacters@1.0.0#/name%20*")
import*("package://localhost:12110/packageContainingWildcardCharacters@1.0.0#/name%20with%20%5C%5Bwildcard%5D!%20characters~~.pkl") import*("package://localhost:0/packageContainingWildcardCharacters@1.0.0#/name%20with%20%5C%5Bwildcard%5D!%20characters~~.pkl")
} }
["package glob and up one level"] { ["package glob and up one level"] {
import*("package://localhost:12110/birds@0.5.0#/catalog/../catalog/*.pkl") import*("package://localhost:0/birds@0.5.0#/catalog/../catalog/*.pkl")
} }
} }
@@ -28,6 +28,6 @@ examples {
} }
["package:"] { ["package:"] {
read*("package://localhost:12110/birds@0.5.0#/**.pkl") read*("package://localhost:0/birds@0.5.0#/**.pkl")
} }
} }
@@ -1,2 +1,2 @@
// no semver // no semver
res = import("package://localhost:12110/foo#/bar.pkl") res = import("package://localhost:0/foo#/bar.pkl")
@@ -1 +1 @@
res = import("package://localhost:12110/birds@0.5.0::invalidalgo:abc123#/catalog/Bird.pkl") res = import("package://localhost:0/birds@0.5.0::invalidalgo:abc123#/catalog/Bird.pkl")
@@ -1 +1 @@
res = import("package://localhost:12110/birds@0.5.0::boguschecksumpart#/catalog/Bird.pkl") res = import("package://localhost:0/birds@0.5.0::boguschecksumpart#/catalog/Bird.pkl")
@@ -1,2 +1,2 @@
// invalid semver // invalid semver
res = import("package://localhost:12110/foo@notAVersion#/bar.pkl") res = import("package://localhost:0/foo@notAVersion#/bar.pkl")
@@ -1,2 +1,2 @@
// no fragment // no fragment
res = import("package://localhost:12110/bar/baz@1.0.0") res = import("package://localhost:0/bar/baz@1.0.0")
@@ -1,2 +1,2 @@
// fragment path must be absolute // fragment path must be absolute
res = import("package://localhost:12110/birds@0.5.0#catalog/Swallow.pkl") res = import("package://localhost:0/birds@0.5.0#catalog/Swallow.pkl")
@@ -1,3 +1,3 @@
import "package://localhost:12110/badPackageZipUrl@1.0.0#/Bug.pkl" import "package://localhost:0/badPackageZipUrl@1.0.0#/Bug.pkl"
res: Bug res: Bug
@@ -1 +1 @@
res = import("package://localhost:12110/badMetadataJson@1.0.0#/Bug.pkl") res = import("package://localhost:0/badMetadataJson@1.0.0#/Bug.pkl")
@@ -1 +1 @@
res = import("package://localhost:12110/badImportsWithinPackage@1.0.0#/unknownDependency.pkl") res = import("package://localhost:0/badImportsWithinPackage@1.0.0#/unknownDependency.pkl")
@@ -1 +1 @@
res = import("package://localhost:12110/badImportsWithinPackage@1.0.0#/invalidPath.pkl") res = import("package://localhost:0/badImportsWithinPackage@1.0.0#/invalidPath.pkl")
@@ -1,2 +1,2 @@
// no semver // no semver
res = read("package://localhost:12110/foo#/bar.pkl") res = read("package://localhost:0/foo#/bar.pkl")
@@ -1,2 +1,2 @@
// invalid semver // invalid semver
res = read("package://localhost:12110/foo@notAVersion#/bar.pkl") res = read("package://localhost:0/foo@notAVersion#/bar.pkl")
@@ -1,2 +1,2 @@
// no fragment // no fragment
res = read("package://localhost:12110/bar/baz@1.0.0") res = read("package://localhost:0/bar/baz@1.0.0")
@@ -1,2 +1,2 @@
// fragment path must be absolute // fragment path must be absolute
res = read("package://localhost:12110/birds@0.5.0#catalog/Swallow.pkl") res = read("package://localhost:0/birds@0.5.0#catalog/Swallow.pkl")
@@ -1 +1 @@
res = import("package://localhost:12110/badImportsWithinPackage@1.0.0#/unknownDependencyReaad.pkl") res = import("package://localhost:0/badImportsWithinPackage@1.0.0#/unknownDependencyReaad.pkl")
@@ -1 +1 @@
res = import("package://localhost:12110/badImportsWithinPackage@1.0.0#/invalidPathReaad.pkl") res = import("package://localhost:0/badImportsWithinPackage@1.0.0#/invalidPathReaad.pkl")
@@ -1,7 +1,7 @@
amends ".../snippetTest.pkl" amends ".../snippetTest.pkl"
import "package://localhost:12110/birds@0.5.0#/Bird.pkl" import "package://localhost:0/birds@0.5.0#/Bird.pkl"
import "package://localhost:12110/fruit@1.0.5#/Fruit.pkl" import "package://localhost:0/fruit@1.0.5#/Fruit.pkl"
examples { examples {
["basic imports"] { ["basic imports"] {
@@ -12,15 +12,15 @@ examples {
name = "Banana" name = "Banana"
} }
} }
import("package://localhost:12110/birds@0.5.0#/catalog/Swallow.pkl") import("package://localhost:0/birds@0.5.0#/catalog/Swallow.pkl")
import("package://localhost:12110/birds@0.5.0#/catalog/Ostritch.pkl") import("package://localhost:0/birds@0.5.0#/catalog/Ostritch.pkl")
} }
["importing while specifying checksum"] { ["importing while specifying checksum"] {
import("package://localhost:12110/birds@0.5.0::sha256:3f19ab9fcee2f44f93a75a09e531db278c6d2cd25206836c8c2c4071cd7d3118#/catalog/Swallow.pkl") import("package://localhost:0/birds@0.5.0::sha256:3f19ab9fcee2f44f93a75a09e531db278c6d2cd25206836c8c2c4071cd7d3118#/catalog/Swallow.pkl")
} }
["reads"] { ["reads"] {
read("package://localhost:12110/birds@0.5.0#/Bird.pkl") read("package://localhost:0/birds@0.5.0#/Bird.pkl")
read("package://localhost:12110/birds@0.5.0#/catalog/Swallow.pkl") read("package://localhost:0/birds@0.5.0#/catalog/Swallow.pkl")
read("package://localhost:12110/birds@0.5.0#/catalog/Ostritch.pkl") read("package://localhost:0/birds@0.5.0#/catalog/Ostritch.pkl")
} }
} }
@@ -2,24 +2,24 @@ amends ".../snippetTest.pkl"
examples { examples {
["glob import"] { ["glob import"] {
import*("package://localhost:12110/birds@0.5.0#/catalog/*.pkl") import*("package://localhost:0/birds@0.5.0#/catalog/*.pkl")
} }
["glob import within package"] { ["glob import within package"] {
import("package://localhost:12110/birds@0.5.0#/catalog.pkl").catalog import("package://localhost:0/birds@0.5.0#/catalog.pkl").catalog
} }
["glob import transitive dep within package"] { ["glob import transitive dep within package"] {
import("package://localhost:12110/birds@0.5.0#/allFruit.pkl").fruit import("package://localhost:0/birds@0.5.0#/allFruit.pkl").fruit
} }
["glob read"] { ["glob read"] {
read*("package://localhost:12110/birds@0.5.0#/catalog/*.pkl") read*("package://localhost:0/birds@0.5.0#/catalog/*.pkl")
} }
["glob read within package"] { ["glob read within package"] {
import("package://localhost:12110/birds@0.5.0#/catalog.pkl").catalogFiles import("package://localhost:0/birds@0.5.0#/catalog.pkl").catalogFiles
} }
["glob read transitive dep within package"] { ["glob read transitive dep within package"] {
import("package://localhost:12110/birds@0.5.0#/allFruit.pkl").fruitFiles import("package://localhost:0/birds@0.5.0#/allFruit.pkl").fruitFiles
} }
["glob import while specifying checksum"] { ["glob import while specifying checksum"] {
import*("package://localhost:12110/birds@0.5.0::sha256:3f19ab9fcee2f44f93a75a09e531db278c6d2cd25206836c8c2c4071cd7d3118#/catalog/*.pkl") import*("package://localhost:0/birds@0.5.0::sha256:3f19ab9fcee2f44f93a75a09e531db278c6d2cd25206836c8c2c4071cd7d3118#/catalog/*.pkl")
} }
} }
@@ -2,6 +2,6 @@ amends "pkl:Project"
dependencies { dependencies {
["birds"] { ["birds"] {
uri = "package://localhost:12110/birds@0.5.0" uri = "package://localhost:0/birds@0.5.0"
} }
} }
@@ -2,6 +2,6 @@ amends "pkl:Project"
dependencies { dependencies {
["birds"] { ["birds"] {
uri = "package://localhost:12110/birds@0.5.0" uri = "package://localhost:0/birds@0.5.0"
} }
} }
@@ -2,6 +2,6 @@ amends "pkl:Project"
dependencies { dependencies {
["birds"] { ["birds"] {
uri = "package://localhost:12110/birds@0.5.0" uri = "package://localhost:0/birds@0.5.0"
} }
} }
@@ -3,6 +3,6 @@ amends "pkl:Project"
dependencies { dependencies {
["birds"] { ["birds"] {
// Should fail because dependency is out of date (PklProject.deps.json version is older) // Should fail because dependency is out of date (PklProject.deps.json version is older)
uri = "package://localhost:12110/birds@0.5.0" uri = "package://localhost:0/birds@0.5.0"
} }
} }
@@ -1,16 +1,16 @@
{ {
"schemaVersion": 1, "schemaVersion": 1,
"resolvedDependencies": { "resolvedDependencies": {
"package://localhost:12110/birds@0": { "package://localhost:0/birds@0": {
"type": "remote", "type": "remote",
"uri": "projectpackage://localhost:12110/birds@0.5.0", "uri": "projectpackage://localhost:0/birds@0.5.0",
"checksums": { "checksums": {
"sha256": "$skipChecksumVerification" "sha256": "$skipChecksumVerification"
} }
}, },
"package://localhost:12110/fruit@1": { "package://localhost:0/fruit@1": {
"type": "remote", "type": "remote",
"uri": "projectpackage://localhost:12110/fruit@1.0.0", "uri": "projectpackage://localhost:0/fruit@1.0.0",
"checksums": { "checksums": {
"sha256": "$skipChecksumVerification" "sha256": "$skipChecksumVerification"
} }
@@ -3,6 +3,6 @@ amends "pkl:Project"
dependencies { dependencies {
["birds"] { ["birds"] {
// out of date because PklProject declares version 0.5.0 // out of date because PklProject declares version 0.5.0
uri = "package://localhost:12110/birds@0.8.0" uri = "package://localhost:0/birds@0.8.0"
} }
} }
@@ -1,16 +1,16 @@
{ {
"schemaVersion": 1, "schemaVersion": 1,
"resolvedDependencies": { "resolvedDependencies": {
"package://localhost:12110/birds@0": { "package://localhost:0/birds@0": {
"type": "remote", "type": "remote",
"uri": "projectpackage://localhost:12110/birds@0.5.0", "uri": "projectpackage://localhost:0/birds@0.5.0",
"checksums": { "checksums": {
"sha256": "$skipChecksumVerification" "sha256": "$skipChecksumVerification"
} }
}, },
"package://localhost:12110/fruit@1": { "package://localhost:0/fruit@1": {
"type": "remote", "type": "remote",
"uri": "projectpackage://localhost:12110/fruit@1.1.0", "uri": "projectpackage://localhost:0/fruit@1.1.0",
"checksums": { "checksums": {
"sha256": "$skipChecksumVerification" "sha256": "$skipChecksumVerification"
} }
@@ -2,6 +2,6 @@ amends "pkl:Project"
dependencies { dependencies {
["birds"] { ["birds"] {
uri = "package://localhost:12110/birds@0.5.0" uri = "package://localhost:0/birds@0.5.0"
} }
} }
@@ -2,13 +2,13 @@ amends "pkl:Project"
dependencies { dependencies {
["birds"] { ["birds"] {
uri = "package://localhost:12110/birds@0.5.0" uri = "package://localhost:0/birds@0.5.0"
} }
["fruits"] { ["fruits"] {
uri = "package://localhost:12110/fruit@1.1.0" uri = "package://localhost:0/fruit@1.1.0"
} }
["badImportsWithinPackage"] { ["badImportsWithinPackage"] {
uri = "package://localhost:12110/badImportsWithinPackage@1.0.0" uri = "package://localhost:0/badImportsWithinPackage@1.0.0"
} }
["project2"] = import("../project2/PklProject") ["project2"] = import("../project2/PklProject")
} }
@@ -1,28 +1,28 @@
{ {
"schemaVersion": 1, "schemaVersion": 1,
"resolvedDependencies": { "resolvedDependencies": {
"package://localhost:12110/birds@0": { "package://localhost:0/birds@0": {
"type": "remote", "type": "remote",
"uri": "projectpackage://localhost:12110/birds@0.5.0", "uri": "projectpackage://localhost:0/birds@0.5.0",
"checksums": { "checksums": {
"sha256": "$skipChecksumVerification" "sha256": "$skipChecksumVerification"
} }
}, },
"package://localhost:12110/fruit@1": { "package://localhost:0/fruit@1": {
"type": "remote", "type": "remote",
"uri": "projectpackage://localhost:12110/fruit@1.1.0", "uri": "projectpackage://localhost:0/fruit@1.1.0",
"checksums": { "checksums": {
"sha256": "$skipChecksumVerification" "sha256": "$skipChecksumVerification"
} }
}, },
"package://localhost:12110/project2@1": { "package://localhost:0/project2@1": {
"type": "local", "type": "local",
"uri": "projectpackage://localhost:12110/project2@1.0.0", "uri": "projectpackage://localhost:0/project2@1.0.0",
"path": "../project2/" "path": "../project2/"
}, },
"package://localhost:12110/badImportsWithinPackage@1": { "package://localhost:0/badImportsWithinPackage@1": {
"type": "remote", "type": "remote",
"uri": "projectpackage://localhost:12110/badImportsWithinPackage@1.0.0", "uri": "projectpackage://localhost:0/badImportsWithinPackage@1.0.0",
"checksums": { "checksums": {
"sha256": "$skipChecksumVerification" "sha256": "$skipChecksumVerification"
} }
@@ -22,16 +22,16 @@ examples {
facts { facts {
["package-relative dependency is not same import as absolute URI dependency"] { ["package-relative dependency is not same import as absolute URI dependency"] {
import("@birds/Bird.pkl") != import("package://localhost:12110/birds@0.5.0#/Bird.pkl") import("@birds/Bird.pkl") != import("package://localhost:0/birds@0.5.0#/Bird.pkl")
} }
["package-relative dependency has scheme projectpackage"] { ["package-relative dependency has scheme projectpackage"] {
import("@birds/Bird.pkl") == import("projectpackage://localhost:12110/birds@0.5.0#/Bird.pkl") import("@birds/Bird.pkl") == import("projectpackage://localhost:0/birds@0.5.0#/Bird.pkl")
} }
["transitive import resolves to same dependency as direct dependency import"] { ["transitive import resolves to same dependency as direct dependency import"] {
Swallow.favoriteFruit == import("@fruits/catalog/apple.pkl") Swallow.favoriteFruit == import("@fruits/catalog/apple.pkl")
} }
["transitive import resolves to same dependency as projectpackage import"] { ["transitive import resolves to same dependency as projectpackage import"] {
Swallow.favoriteFruit == import("projectpackage://localhost:12110/fruit@1.1.0#/catalog/apple.pkl") Swallow.favoriteFruit == import("projectpackage://localhost:0/fruit@1.1.0#/catalog/apple.pkl")
Swallow.favoriteFruit != import("projectpackage://localhost:12110/fruit@1.0.5#/catalog/apple.pkl") Swallow.favoriteFruit != import("projectpackage://localhost:0/fruit@1.0.5#/catalog/apple.pkl")
} }
} }
@@ -7,7 +7,7 @@ examples {
} }
["glob-import absolute package uri"] { ["glob-import absolute package uri"] {
import*("package://localhost:12110/birds@0.5.0#/catalog/*.pkl") import*("package://localhost:0/birds@0.5.0#/catalog/*.pkl")
} }
["glob-import local project"] { ["glob-import local project"] {
@@ -32,6 +32,6 @@ examples {
} }
["glob-read absolute package uri"] { ["glob-read absolute package uri"] {
read*("package://localhost:12110/birds@0.5.0#/catalog/*.pkl") read*("package://localhost:0/birds@0.5.0#/catalog/*.pkl")
} }
} }
@@ -2,13 +2,13 @@ amends "pkl:Project"
package { package {
name = "project2" name = "project2"
baseUri = "package://localhost:12110/project2" baseUri = "package://localhost:0/project2"
version = "1.0.0" version = "1.0.0"
packageZipUrl = "https://localhost:12110/project2/project2-\(version).zip" packageZipUrl = "https://localhost:0/project2/project2-\(version).zip"
} }
dependencies { dependencies {
["burds"] { ["burds"] {
uri = "package://localhost:12110/birds@0.5.0" uri = "package://localhost:0/birds@0.5.0"
} }
} }
@@ -1,16 +1,16 @@
{ {
"schemaVersion": 1, "schemaVersion": 1,
"resolvedDependencies": { "resolvedDependencies": {
"package://localhost:12110/birds@0": { "package://localhost:0/birds@0": {
"type": "remote", "type": "remote",
"uri": "projectpackage://localhost:12110/birds@0.5.0", "uri": "projectpackage://localhost:0/birds@0.5.0",
"checksums": { "checksums": {
"sha256": "$skipChecksumVerification" "sha256": "$skipChecksumVerification"
} }
}, },
"package://localhost:12110/fruit@1": { "package://localhost:0/fruit@1": {
"type": "remote", "type": "remote",
"uri": "projectpackage://localhost:12110/fruit@1.1.0", "uri": "projectpackage://localhost:0/fruit@1.1.0",
"checksums": { "checksums": {
"sha256": "$skipChecksumVerification" "sha256": "$skipChecksumVerification"
} }
@@ -1,28 +1,28 @@
{ {
"schemaVersion": 1, "schemaVersion": 1,
"resolvedDependencies": { "resolvedDependencies": {
"package://localhost:12110/birds@0": { "package://localhost:0/birds@0": {
"type": "remote", "type": "remote",
"uri": "projectpackage://localhost:12110/birds@0.5.0", "uri": "projectpackage://localhost:0/birds@0.5.0",
"checksums": { "checksums": {
"sha256": "$skipChecksumVerification" "sha256": "$skipChecksumVerification"
} }
}, },
"package://localhost:12110/fruit@1": { "package://localhost:0/fruit@1": {
"type": "remote", "type": "remote",
"uri": "projectpackage://localhost:12110/fruit@1.1.0", "uri": "projectpackage://localhost:0/fruit@1.1.0",
"checksums": { "checksums": {
"sha256": "$skipChecksumVerification" "sha256": "$skipChecksumVerification"
} }
}, },
"package://localhost:12110/project2@1": { "package://localhost:0/project2@1": {
"type": "local", "type": "local",
"uri": "projectpackage://localhost:12110/project2@1.0.0", "uri": "projectpackage://localhost:0/project2@1.0.0",
"path": "../project2/" "path": "../project2/"
}, },
"package://localhost:12110/badImportsWithinPackage@1": { "package://localhost:0/badImportsWithinPackage@1": {
"type": "remote", "type": "remote",
"uri": "projectpackage://localhost:12110/badImportsWithinPackage@1.0.0", "uri": "projectpackage://localhost:0/badImportsWithinPackage@1.0.0",
"checksums": { "checksums": {
"sha256": "$skipChecksumVerification" "sha256": "$skipChecksumVerification"
} }
@@ -3,6 +3,6 @@ amends "pkl:Project"
dependencies { dependencies {
["fruit"] { ["fruit"] {
// need to manually keep the checksum in `PklProject.deps.json` in sync // need to manually keep the checksum in `PklProject.deps.json` in sync
uri = "package://localhost:12110/fruit@1.0.5" uri = "package://localhost:0/fruit@1.0.5"
} }
} }
@@ -1,11 +1,11 @@
{ {
"schemaVersion": 1, "schemaVersion": 1,
"resolvedDependencies": { "resolvedDependencies": {
"package://localhost:12110/fruit@1": { "package://localhost:0/fruit@1": {
"type": "remote", "type": "remote",
"uri": "projectpackage://localhost:12110/fruit@1.0.5", "uri": "projectpackage://localhost:0/fruit@1.0.5",
"checksums": { "checksums": {
"sha256": "abd173e8a25f5b930b0e34269a441e32c9d95e0b0a715bc6eff918f0afd0688e" "sha256": "34a15b02346e6acb85da5bd71d8b0738a79008b38a7fc805e5869d9129ad27d2"
} }
} }
} }
@@ -5,7 +5,7 @@ import "pkl:reflect"
myProject: Project = (Project.newInstance(module)) { myProject: Project = (Project.newInstance(module)) {
dependencies { dependencies {
["birds"] { ["birds"] {
uri = "package://localhost:12110/birds@0.5.0" uri = "package://localhost:0/birds@0.5.0"
} }
} }
} }
@@ -1,16 +1,16 @@
{ {
"schemaVersion": 1, "schemaVersion": 1,
"resolvedDependencies": { "resolvedDependencies": {
"package://localhost:12110/birds@0": { "package://localhost:0/birds@0": {
"type": "remote", "type": "remote",
"uri": "projectpackage://localhost:12110/birds@0.5.0", "uri": "projectpackage://localhost:0/birds@0.5.0",
"checksums": { "checksums": {
"sha256": "$skipChecksumVerification" "sha256": "$skipChecksumVerification"
} }
}, },
"package://localhost:12110/fruit@1": { "package://localhost:0/fruit@1": {
"type": "remote", "type": "remote",
"uri": "projectpackage://localhost:12110/fruit@1.1.0", "uri": "projectpackage://localhost:0/fruit@1.1.0",
"checksums": { "checksums": {
"sha256": "$skipChecksumVerification" "sha256": "$skipChecksumVerification"
} }
@@ -69,13 +69,13 @@ examples {
} }
["package"] { ["package"] {
new { new {
["package://localhost:12110/birds@0.5.0#/catalog/Ostritch.pkl"] { ["package://localhost:0/birds@0.5.0#/catalog/Ostritch.pkl"] {
name = "Ostritch" name = "Ostritch"
favoriteFruit { favoriteFruit {
name = "Orange" name = "Orange"
} }
} }
["package://localhost:12110/birds@0.5.0#/catalog/Swallow.pkl"] { ["package://localhost:0/birds@0.5.0#/catalog/Swallow.pkl"] {
name = "Swallow" name = "Swallow"
favoriteFruit { favoriteFruit {
name = "Apple" name = "Apple"
@@ -83,31 +83,31 @@ examples {
} }
} }
new { new {
"package://localhost:12110/birds@0.5.0#/Bird.pkl" "package://localhost:0/birds@0.5.0#/Bird.pkl"
"package://localhost:12110/birds@0.5.0#/allFruit.pkl" "package://localhost:0/birds@0.5.0#/allFruit.pkl"
"package://localhost:12110/birds@0.5.0#/catalog.pkl" "package://localhost:0/birds@0.5.0#/catalog.pkl"
"package://localhost:12110/birds@0.5.0#/catalog/Ostritch.pkl" "package://localhost:0/birds@0.5.0#/catalog/Ostritch.pkl"
"package://localhost:12110/birds@0.5.0#/catalog/Swallow.pkl" "package://localhost:0/birds@0.5.0#/catalog/Swallow.pkl"
"package://localhost:12110/birds@0.5.0#/some/dir/Bird.pkl" "package://localhost:0/birds@0.5.0#/some/dir/Bird.pkl"
} }
} }
["globbing with absolute URIs and percent encoding"] { ["globbing with absolute URIs and percent encoding"] {
new { new {
["package://localhost:12110/packageContainingWildcardCharacters@1.0.0#/name%20with%20%5Bwildcard%5D!%20characters~~.pkl"] {} ["package://localhost:0/packageContainingWildcardCharacters@1.0.0#/name%20with%20%5Bwildcard%5D!%20characters~~.pkl"] {}
} }
new { new {
["package://localhost:12110/packageContainingWildcardCharacters@1.0.0#/name%20with%20%5Bwildcard%5D!%20characters~~.pkl"] {} ["package://localhost:0/packageContainingWildcardCharacters@1.0.0#/name%20with%20%5Bwildcard%5D!%20characters~~.pkl"] {}
} }
} }
["package glob and up one level"] { ["package glob and up one level"] {
new { new {
["package://localhost:12110/birds@0.5.0#/catalog/../catalog/Ostritch.pkl"] { ["package://localhost:0/birds@0.5.0#/catalog/../catalog/Ostritch.pkl"] {
name = "Ostritch" name = "Ostritch"
favoriteFruit { favoriteFruit {
name = "Orange" name = "Orange"
} }
} }
["package://localhost:12110/birds@0.5.0#/catalog/../catalog/Swallow.pkl"] { ["package://localhost:0/birds@0.5.0#/catalog/../catalog/Swallow.pkl"] {
name = "Swallow" name = "Swallow"
favoriteFruit { favoriteFruit {
name = "Apple" name = "Apple"
@@ -96,8 +96,8 @@ examples {
} }
["package:"] { ["package:"] {
new { new {
["package://localhost:12110/birds@0.5.0#/Bird.pkl"] { ["package://localhost:0/birds@0.5.0#/Bird.pkl"] {
uri = "package://localhost:12110/birds@0.5.0#/Bird.pkl" uri = "package://localhost:0/birds@0.5.0#/Bird.pkl"
text = """ text = """
open module birds.Bird open module birds.Bird
@@ -110,8 +110,8 @@ examples {
""" """
base64 = "b3BlbiBtb2R1bGUgYmlyZHMuQmlyZAoKaW1wb3J0ICJAZnJ1aXRpZXMvRnJ1aXQucGtsIgoKbmFtZTogU3RyaW5nCgpmYXZvcml0ZUZydWl0OiBGcnVpdAo=" base64 = "b3BlbiBtb2R1bGUgYmlyZHMuQmlyZAoKaW1wb3J0ICJAZnJ1aXRpZXMvRnJ1aXQucGtsIgoKbmFtZTogU3RyaW5nCgpmYXZvcml0ZUZydWl0OiBGcnVpdAo="
} }
["package://localhost:12110/birds@0.5.0#/allFruit.pkl"] { ["package://localhost:0/birds@0.5.0#/allFruit.pkl"] {
uri = "package://localhost:12110/birds@0.5.0#/allFruit.pkl" uri = "package://localhost:0/birds@0.5.0#/allFruit.pkl"
text = """ text = """
module birds.allFruit module birds.allFruit
@@ -121,8 +121,8 @@ examples {
""" """
base64 = "bW9kdWxlIGJpcmRzLmFsbEZydWl0CgpmcnVpdCA9IGltcG9ydCooIkBmcnVpdGllcy9jYXRhbG9nLyoucGtsIikKZnJ1aXRGaWxlcyA9IHJlYWQqKCJAZnJ1aXRpZXMvY2F0YWxvZy8qLnBrbCIpCg==" base64 = "bW9kdWxlIGJpcmRzLmFsbEZydWl0CgpmcnVpdCA9IGltcG9ydCooIkBmcnVpdGllcy9jYXRhbG9nLyoucGtsIikKZnJ1aXRGaWxlcyA9IHJlYWQqKCJAZnJ1aXRpZXMvY2F0YWxvZy8qLnBrbCIpCg=="
} }
["package://localhost:12110/birds@0.5.0#/catalog.pkl"] { ["package://localhost:0/birds@0.5.0#/catalog.pkl"] {
uri = "package://localhost:12110/birds@0.5.0#/catalog.pkl" uri = "package://localhost:0/birds@0.5.0#/catalog.pkl"
text = """ text = """
module birds.catalog module birds.catalog
@@ -132,8 +132,8 @@ examples {
""" """
base64 = "bW9kdWxlIGJpcmRzLmNhdGFsb2cKCmNhdGFsb2cgPSBpbXBvcnQqKCJjYXRhbG9nLyoucGtsIikKY2F0YWxvZ0ZpbGVzID0gcmVhZCooImNhdGFsb2cvKi5wa2wiKQo=" base64 = "bW9kdWxlIGJpcmRzLmNhdGFsb2cKCmNhdGFsb2cgPSBpbXBvcnQqKCJjYXRhbG9nLyoucGtsIikKY2F0YWxvZ0ZpbGVzID0gcmVhZCooImNhdGFsb2cvKi5wa2wiKQo="
} }
["package://localhost:12110/birds@0.5.0#/catalog/Ostritch.pkl"] { ["package://localhost:0/birds@0.5.0#/catalog/Ostritch.pkl"] {
uri = "package://localhost:12110/birds@0.5.0#/catalog/Ostritch.pkl" uri = "package://localhost:0/birds@0.5.0#/catalog/Ostritch.pkl"
text = """ text = """
amends "../Bird.pkl" amends "../Bird.pkl"
@@ -146,8 +146,8 @@ examples {
""" """
base64 = "YW1lbmRzICIuLi9CaXJkLnBrbCIKCm5hbWUgPSAiT3N0cml0Y2giCgpmYXZvcml0ZUZydWl0IHsKICBuYW1lID0gIk9yYW5nZSIKfQo=" base64 = "YW1lbmRzICIuLi9CaXJkLnBrbCIKCm5hbWUgPSAiT3N0cml0Y2giCgpmYXZvcml0ZUZydWl0IHsKICBuYW1lID0gIk9yYW5nZSIKfQo="
} }
["package://localhost:12110/birds@0.5.0#/catalog/Swallow.pkl"] { ["package://localhost:0/birds@0.5.0#/catalog/Swallow.pkl"] {
uri = "package://localhost:12110/birds@0.5.0#/catalog/Swallow.pkl" uri = "package://localhost:0/birds@0.5.0#/catalog/Swallow.pkl"
text = """ text = """
amends "../Bird.pkl" amends "../Bird.pkl"
@@ -160,8 +160,8 @@ examples {
""" """
base64 = "YW1lbmRzICIuLi9CaXJkLnBrbCIKCmltcG9ydCAiQGZydWl0aWVzL2NhdGFsb2cvYXBwbGUucGtsIgoKbmFtZSA9ICJTd2FsbG93IgoKZmF2b3JpdGVGcnVpdCA9IGFwcGxlCg==" base64 = "YW1lbmRzICIuLi9CaXJkLnBrbCIKCmltcG9ydCAiQGZydWl0aWVzL2NhdGFsb2cvYXBwbGUucGtsIgoKbmFtZSA9ICJTd2FsbG93IgoKZmF2b3JpdGVGcnVpdCA9IGFwcGxlCg=="
} }
["package://localhost:12110/birds@0.5.0#/some/dir/Bird.pkl"] { ["package://localhost:0/birds@0.5.0#/some/dir/Bird.pkl"] {
uri = "package://localhost:12110/birds@0.5.0#/some/dir/Bird.pkl" uri = "package://localhost:0/birds@0.5.0#/some/dir/Bird.pkl"
text = """ text = """
amends "..." amends "..."
@@ -1,8 +1,8 @@
–– Pkl Error –– –– Pkl Error ––
Module URI `package://localhost:12110/foo#/bar.pkl` has invalid syntax. Module URI `package://localhost:0/foo#/bar.pkl` has invalid syntax.
x | res = import("package://localhost:12110/foo#/bar.pkl") x | res = import("package://localhost:0/foo#/bar.pkl")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
at badImport1.error#res (file:///$snippetsDir/input/packages/badImport1.error.pkl) at badImport1.error#res (file:///$snippetsDir/input/packages/badImport1.error.pkl)
Invalid path `/foo`. Invalid path `/foo`.
@@ -1,8 +1,8 @@
–– Pkl Error –– –– Pkl Error ––
Module URI `package://localhost:12110/birds@0.5.0::invalidalgo:abc123#/catalog/Bird.pkl` has invalid syntax. Module URI `package://localhost:0/birds@0.5.0::invalidalgo:abc123#/catalog/Bird.pkl` has invalid syntax.
x | res = import("package://localhost:12110/birds@0.5.0::invalidalgo:abc123#/catalog/Bird.pkl") x | res = import("package://localhost:0/birds@0.5.0::invalidalgo:abc123#/catalog/Bird.pkl")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
at badImport10.error#res (file:///$snippetsDir/input/packages/badImport10.error.pkl) at badImport10.error#res (file:///$snippetsDir/input/packages/badImport10.error.pkl)
Unrecognized checksum algorithm: `invalidalgo`. Unrecognized checksum algorithm: `invalidalgo`.
@@ -1,8 +1,8 @@
–– Pkl Error –– –– Pkl Error ––
Module URI `package://localhost:12110/birds@0.5.0::boguschecksumpart#/catalog/Bird.pkl` has invalid syntax. Module URI `package://localhost:0/birds@0.5.0::boguschecksumpart#/catalog/Bird.pkl` has invalid syntax.
x | res = import("package://localhost:12110/birds@0.5.0::boguschecksumpart#/catalog/Bird.pkl") x | res = import("package://localhost:0/birds@0.5.0::boguschecksumpart#/catalog/Bird.pkl")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
at badImport11.error#res (file:///$snippetsDir/input/packages/badImport11.error.pkl) at badImport11.error#res (file:///$snippetsDir/input/packages/badImport11.error.pkl)
Invalid checksum specification: `boguschecksumpart`. Invalid checksum specification: `boguschecksumpart`.
@@ -1,8 +1,8 @@
–– Pkl Error –– –– Pkl Error ––
Module URI `package://localhost:12110/foo@notAVersion#/bar.pkl` has invalid syntax. Module URI `package://localhost:0/foo@notAVersion#/bar.pkl` has invalid syntax.
x | res = import("package://localhost:12110/foo@notAVersion#/bar.pkl") x | res = import("package://localhost:0/foo@notAVersion#/bar.pkl")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
at badImport2.error#res (file:///$snippetsDir/input/packages/badImport2.error.pkl) at badImport2.error#res (file:///$snippetsDir/input/packages/badImport2.error.pkl)
`notAVersion` could not be parsed as a semantic version number. `notAVersion` could not be parsed as a semantic version number.
@@ -1,8 +1,8 @@
–– Pkl Error –– –– Pkl Error ––
Module URI `package://localhost:12110/bar/baz@1.0.0` has invalid syntax. Module URI `package://localhost:0/bar/baz@1.0.0` has invalid syntax.
x | res = import("package://localhost:12110/bar/baz@1.0.0") x | res = import("package://localhost:0/bar/baz@1.0.0")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
at badImport3.error#res (file:///$snippetsDir/input/packages/badImport3.error.pkl) at badImport3.error#res (file:///$snippetsDir/input/packages/badImport3.error.pkl)
Expected URI to contain a fragment. Expected URI to contain a fragment.
@@ -1,8 +1,8 @@
–– Pkl Error –– –– Pkl Error ––
Module URI `package://localhost:12110/birds@0.5.0#catalog/Swallow.pkl` has invalid syntax. Module URI `package://localhost:0/birds@0.5.0#catalog/Swallow.pkl` has invalid syntax.
x | res = import("package://localhost:12110/birds@0.5.0#catalog/Swallow.pkl") x | res = import("package://localhost:0/birds@0.5.0#catalog/Swallow.pkl")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
at badImport4.error#res (file:///$snippetsDir/input/packages/badImport4.error.pkl) at badImport4.error#res (file:///$snippetsDir/input/packages/badImport4.error.pkl)
Cannot have a relative fragment path `catalog/Swallow.pkl`. Cannot have a relative fragment path `catalog/Swallow.pkl`.
@@ -1,8 +1,8 @@
–– Pkl Error –– –– Pkl Error ––
Expected the zip asset for package `package://localhost:12110/badPackageZipUrl@1.0.0` to be an HTTPS URI, but got `ftp://wait/a/minute`. Expected the zip asset for package `package://localhost:0/badPackageZipUrl@1.0.0` to be an HTTPS URI, but got `ftp://wait/a/minute`.
x | import "package://localhost:12110/badPackageZipUrl@1.0.0#/Bug.pkl" x | import "package://localhost:0/badPackageZipUrl@1.0.0#/Bug.pkl"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
at badImport6.error#Bug (file:///$snippetsDir/input/packages/badImport6.error.pkl) at badImport6.error#Bug (file:///$snippetsDir/input/packages/badImport6.error.pkl)
x | res: Bug x | res: Bug
@@ -1,13 +1,13 @@
–– Pkl Error –– –– Pkl Error ––
Received invalid dependency metadata for package `package://localhost:12110/badMetadataJson@1.0.0` when making request `GET https://localhost:12110/badMetadataJson@1.0.0`: Received invalid dependency metadata for package `package://localhost:0/badMetadataJson@1.0.0` when making request `GET https://localhost:0/badMetadataJson@1.0.0`:
Malformed JSON: Expected 'r' at 1:2. Malformed JSON: Expected 'r' at 1:2.
Original input: Original input:
`this is not json `this is not json
` `
x | res = import("package://localhost:12110/badMetadataJson@1.0.0#/Bug.pkl") x | res = import("package://localhost:0/badMetadataJson@1.0.0#/Bug.pkl")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
at badImport7.error#res (file:///$snippetsDir/input/packages/badImport7.error.pkl) at badImport7.error#res (file:///$snippetsDir/input/packages/badImport7.error.pkl)
xxx | text = renderer.renderDocument(value) xxx | text = renderer.renderDocument(value)
@@ -1,9 +1,9 @@
–– Pkl Error –– –– Pkl Error ––
Cannot find dependency named `fruits`, because it was not declared in package `package://localhost:12110/badImportsWithinPackage@1.0.0`. Cannot find dependency named `fruits`, because it was not declared in package `package://localhost:0/badImportsWithinPackage@1.0.0`.
x | res = import("@fruits/Foo.pkl") x | res = import("@fruits/Foo.pkl")
^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^
at badImport8.error#res (package://localhost:12110/badImportsWithinPackage@1.0.0#/unknownDependency.pkl) at badImport8.error#res (package://localhost:0/badImportsWithinPackage@1.0.0#/unknownDependency.pkl)
xxx | text = renderer.renderDocument(value) xxx | text = renderer.renderDocument(value)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -1,9 +1,9 @@
–– Pkl Error –– –– Pkl Error ––
Cannot find module `package://localhost:12110/badImportsWithinPackage@1.0.0#/not/a/valid/path.pkl`. Cannot find module `package://localhost:0/badImportsWithinPackage@1.0.0#/not/a/valid/path.pkl`.
x | res = import("not/a/valid/path.pkl") x | res = import("not/a/valid/path.pkl")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
at invalidPath#res (package://localhost:12110/badImportsWithinPackage@1.0.0#/invalidPath.pkl) at invalidPath#res (package://localhost:0/badImportsWithinPackage@1.0.0#/invalidPath.pkl)
xxx | text = renderer.renderDocument(value) xxx | text = renderer.renderDocument(value)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -1,8 +1,8 @@
–– Pkl Error –– –– Pkl Error ––
Resource URI `package://localhost:12110/foo#/bar.pkl` has invalid syntax. Resource URI `package://localhost:0/foo#/bar.pkl` has invalid syntax.
x | res = read("package://localhost:12110/foo#/bar.pkl") x | res = read("package://localhost:0/foo#/bar.pkl")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
at badRead1.error#res (file:///$snippetsDir/input/packages/badRead1.error.pkl) at badRead1.error#res (file:///$snippetsDir/input/packages/badRead1.error.pkl)
Invalid path `/foo`. Invalid path `/foo`.
@@ -1,8 +1,8 @@
–– Pkl Error –– –– Pkl Error ––
Resource URI `package://localhost:12110/foo@notAVersion#/bar.pkl` has invalid syntax. Resource URI `package://localhost:0/foo@notAVersion#/bar.pkl` has invalid syntax.
x | res = read("package://localhost:12110/foo@notAVersion#/bar.pkl") x | res = read("package://localhost:0/foo@notAVersion#/bar.pkl")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
at badRead2.error#res (file:///$snippetsDir/input/packages/badRead2.error.pkl) at badRead2.error#res (file:///$snippetsDir/input/packages/badRead2.error.pkl)
`notAVersion` could not be parsed as a semantic version number. `notAVersion` could not be parsed as a semantic version number.
@@ -1,8 +1,8 @@
–– Pkl Error –– –– Pkl Error ––
Resource URI `package://localhost:12110/bar/baz@1.0.0` has invalid syntax. Resource URI `package://localhost:0/bar/baz@1.0.0` has invalid syntax.
x | res = read("package://localhost:12110/bar/baz@1.0.0") x | res = read("package://localhost:0/bar/baz@1.0.0")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
at badRead3.error#res (file:///$snippetsDir/input/packages/badRead3.error.pkl) at badRead3.error#res (file:///$snippetsDir/input/packages/badRead3.error.pkl)
Expected URI to contain a fragment. Expected URI to contain a fragment.
@@ -1,8 +1,8 @@
–– Pkl Error –– –– Pkl Error ––
Resource URI `package://localhost:12110/birds@0.5.0#catalog/Swallow.pkl` has invalid syntax. Resource URI `package://localhost:0/birds@0.5.0#catalog/Swallow.pkl` has invalid syntax.
x | res = read("package://localhost:12110/birds@0.5.0#catalog/Swallow.pkl") x | res = read("package://localhost:0/birds@0.5.0#catalog/Swallow.pkl")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
at badRead4.error#res (file:///$snippetsDir/input/packages/badRead4.error.pkl) at badRead4.error#res (file:///$snippetsDir/input/packages/badRead4.error.pkl)
Cannot have a relative fragment path `catalog/Swallow.pkl`. Cannot have a relative fragment path `catalog/Swallow.pkl`.
@@ -1,8 +1,8 @@
–– Pkl Error –– –– Pkl Error ––
Cannot find module `package://localhost:12110/badImportsWithinPackage@1.0.0#/unknownDependencyReaad.pkl`. Cannot find module `package://localhost:0/badImportsWithinPackage@1.0.0#/unknownDependencyReaad.pkl`.
x | res = import("package://localhost:12110/badImportsWithinPackage@1.0.0#/unknownDependencyReaad.pkl") x | res = import("package://localhost:0/badImportsWithinPackage@1.0.0#/unknownDependencyReaad.pkl")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
at badRead8.error#res (file:///$snippetsDir/input/packages/badRead8.error.pkl) at badRead8.error#res (file:///$snippetsDir/input/packages/badRead8.error.pkl)
xxx | text = renderer.renderDocument(value) xxx | text = renderer.renderDocument(value)
@@ -1,8 +1,8 @@
–– Pkl Error –– –– Pkl Error ––
Cannot find module `package://localhost:12110/badImportsWithinPackage@1.0.0#/invalidPathReaad.pkl`. Cannot find module `package://localhost:0/badImportsWithinPackage@1.0.0#/invalidPathReaad.pkl`.
x | res = import("package://localhost:12110/badImportsWithinPackage@1.0.0#/invalidPathReaad.pkl") x | res = import("package://localhost:0/badImportsWithinPackage@1.0.0#/invalidPathReaad.pkl")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
at badRead9.error#res (file:///$snippetsDir/input/packages/badRead9.error.pkl) at badRead9.error#res (file:///$snippetsDir/input/packages/badRead9.error.pkl)
xxx | text = renderer.renderDocument(value) xxx | text = renderer.renderDocument(value)
@@ -29,7 +29,7 @@ examples {
} }
["reads"] { ["reads"] {
new { new {
uri = "package://localhost:12110/birds@0.5.0#/Bird.pkl" uri = "package://localhost:0/birds@0.5.0#/Bird.pkl"
text = """ text = """
open module birds.Bird open module birds.Bird
@@ -43,7 +43,7 @@ examples {
base64 = "b3BlbiBtb2R1bGUgYmlyZHMuQmlyZAoKaW1wb3J0ICJAZnJ1aXRpZXMvRnJ1aXQucGtsIgoKbmFtZTogU3RyaW5nCgpmYXZvcml0ZUZydWl0OiBGcnVpdAo=" base64 = "b3BlbiBtb2R1bGUgYmlyZHMuQmlyZAoKaW1wb3J0ICJAZnJ1aXRpZXMvRnJ1aXQucGtsIgoKbmFtZTogU3RyaW5nCgpmYXZvcml0ZUZydWl0OiBGcnVpdAo="
} }
new { new {
uri = "package://localhost:12110/birds@0.5.0#/catalog/Swallow.pkl" uri = "package://localhost:0/birds@0.5.0#/catalog/Swallow.pkl"
text = """ text = """
amends "../Bird.pkl" amends "../Bird.pkl"
@@ -57,7 +57,7 @@ examples {
base64 = "YW1lbmRzICIuLi9CaXJkLnBrbCIKCmltcG9ydCAiQGZydWl0aWVzL2NhdGFsb2cvYXBwbGUucGtsIgoKbmFtZSA9ICJTd2FsbG93IgoKZmF2b3JpdGVGcnVpdCA9IGFwcGxlCg==" base64 = "YW1lbmRzICIuLi9CaXJkLnBrbCIKCmltcG9ydCAiQGZydWl0aWVzL2NhdGFsb2cvYXBwbGUucGtsIgoKbmFtZSA9ICJTd2FsbG93IgoKZmF2b3JpdGVGcnVpdCA9IGFwcGxlCg=="
} }
new { new {
uri = "package://localhost:12110/birds@0.5.0#/catalog/Ostritch.pkl" uri = "package://localhost:0/birds@0.5.0#/catalog/Ostritch.pkl"
text = """ text = """
amends "../Bird.pkl" amends "../Bird.pkl"
@@ -1,13 +1,13 @@
examples { examples {
["glob import"] { ["glob import"] {
new { new {
["package://localhost:12110/birds@0.5.0#/catalog/Ostritch.pkl"] { ["package://localhost:0/birds@0.5.0#/catalog/Ostritch.pkl"] {
name = "Ostritch" name = "Ostritch"
favoriteFruit { favoriteFruit {
name = "Orange" name = "Orange"
} }
} }
["package://localhost:12110/birds@0.5.0#/catalog/Swallow.pkl"] { ["package://localhost:0/birds@0.5.0#/catalog/Swallow.pkl"] {
name = "Swallow" name = "Swallow"
favoriteFruit { favoriteFruit {
name = "Apple" name = "Apple"
@@ -40,8 +40,8 @@ examples {
} }
["glob read"] { ["glob read"] {
new { new {
["package://localhost:12110/birds@0.5.0#/catalog/Ostritch.pkl"] { ["package://localhost:0/birds@0.5.0#/catalog/Ostritch.pkl"] {
uri = "package://localhost:12110/birds@0.5.0#/catalog/Ostritch.pkl" uri = "package://localhost:0/birds@0.5.0#/catalog/Ostritch.pkl"
text = """ text = """
amends "../Bird.pkl" amends "../Bird.pkl"
@@ -54,8 +54,8 @@ examples {
""" """
base64 = "YW1lbmRzICIuLi9CaXJkLnBrbCIKCm5hbWUgPSAiT3N0cml0Y2giCgpmYXZvcml0ZUZydWl0IHsKICBuYW1lID0gIk9yYW5nZSIKfQo=" base64 = "YW1lbmRzICIuLi9CaXJkLnBrbCIKCm5hbWUgPSAiT3N0cml0Y2giCgpmYXZvcml0ZUZydWl0IHsKICBuYW1lID0gIk9yYW5nZSIKfQo="
} }
["package://localhost:12110/birds@0.5.0#/catalog/Swallow.pkl"] { ["package://localhost:0/birds@0.5.0#/catalog/Swallow.pkl"] {
uri = "package://localhost:12110/birds@0.5.0#/catalog/Swallow.pkl" uri = "package://localhost:0/birds@0.5.0#/catalog/Swallow.pkl"
text = """ text = """
amends "../Bird.pkl" amends "../Bird.pkl"
@@ -73,7 +73,7 @@ examples {
["glob read within package"] { ["glob read within package"] {
new { new {
["catalog/Ostritch.pkl"] { ["catalog/Ostritch.pkl"] {
uri = "package://localhost:12110/birds@0.5.0#/catalog/Ostritch.pkl" uri = "package://localhost:0/birds@0.5.0#/catalog/Ostritch.pkl"
text = """ text = """
amends "../Bird.pkl" amends "../Bird.pkl"
@@ -87,7 +87,7 @@ examples {
base64 = "YW1lbmRzICIuLi9CaXJkLnBrbCIKCm5hbWUgPSAiT3N0cml0Y2giCgpmYXZvcml0ZUZydWl0IHsKICBuYW1lID0gIk9yYW5nZSIKfQo=" base64 = "YW1lbmRzICIuLi9CaXJkLnBrbCIKCm5hbWUgPSAiT3N0cml0Y2giCgpmYXZvcml0ZUZydWl0IHsKICBuYW1lID0gIk9yYW5nZSIKfQo="
} }
["catalog/Swallow.pkl"] { ["catalog/Swallow.pkl"] {
uri = "package://localhost:12110/birds@0.5.0#/catalog/Swallow.pkl" uri = "package://localhost:0/birds@0.5.0#/catalog/Swallow.pkl"
text = """ text = """
amends "../Bird.pkl" amends "../Bird.pkl"
@@ -105,7 +105,7 @@ examples {
["glob read transitive dep within package"] { ["glob read transitive dep within package"] {
new { new {
["@fruities/catalog/apple.pkl"] { ["@fruities/catalog/apple.pkl"] {
uri = "package://localhost:12110/fruit@1.0.5#/catalog/apple.pkl" uri = "package://localhost:0/fruit@1.0.5#/catalog/apple.pkl"
text = """ text = """
amends "../Fruit.pkl" amends "../Fruit.pkl"
@@ -118,13 +118,13 @@ examples {
} }
["glob import while specifying checksum"] { ["glob import while specifying checksum"] {
new { new {
["package://localhost:12110/birds@0.5.0::sha256:3f19ab9fcee2f44f93a75a09e531db278c6d2cd25206836c8c2c4071cd7d3118#/catalog/Ostritch.pkl"] { ["package://localhost:0/birds@0.5.0::sha256:3f19ab9fcee2f44f93a75a09e531db278c6d2cd25206836c8c2c4071cd7d3118#/catalog/Ostritch.pkl"] {
name = "Ostritch" name = "Ostritch"
favoriteFruit { favoriteFruit {
name = "Orange" name = "Orange"
} }
} }
["package://localhost:12110/birds@0.5.0::sha256:3f19ab9fcee2f44f93a75a09e531db278c6d2cd25206836c8c2c4071cd7d3118#/catalog/Swallow.pkl"] { ["package://localhost:0/birds@0.5.0::sha256:3f19ab9fcee2f44f93a75a09e531db278c6d2cd25206836c8c2c4071cd7d3118#/catalog/Swallow.pkl"] {
name = "Swallow" name = "Swallow"
favoriteFruit { favoriteFruit {
name = "Apple" name = "Apple"
@@ -1,5 +1,5 @@
–– Pkl Error –– –– Pkl Error ––
Did not find a resolved dependency for package `package://localhost:12110/birds@0.5.0`. Did not find a resolved dependency for package `package://localhost:0/birds@0.5.0`.
Run `pkl project resolve` to update resolved dependencies. Run `pkl project resolve` to update resolved dependencies.
@@ -1,14 +1,14 @@
–– Pkl Error –– –– Pkl Error ––
Transitive dependency declared by package `package://localhost:12110/birds@0.5.0` is newer than what is declared in `PklProject.deps.json`. Transitive dependency declared by package `package://localhost:0/birds@0.5.0` is newer than what is declared in `PklProject.deps.json`.
Declared: `package://localhost:12110/fruit@1.0.5` Declared: `package://localhost:0/fruit@1.0.5`
Resolved: `package://localhost:12110/fruit@1.0.0` Resolved: `package://localhost:0/fruit@1.0.0`
Run `pkl project resolve` to update resolved dependencies. Run `pkl project resolve` to update resolved dependencies.
x | import "@fruities/Fruit.pkl" x | import "@fruities/Fruit.pkl"
^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^
at bug#Bird (projectpackage://localhost:12110/birds@0.5.0#/Bird.pkl) at bug#Bird (projectpackage://localhost:0/birds@0.5.0#/Bird.pkl)
x | bird: Bird x | bird: Bird
^^^^ ^^^^
@@ -1,8 +1,8 @@
–– Pkl Error –– –– Pkl Error ––
Project `file:///$snippetsDir/input/projects/badProjectDeps6/PklProject` declares a dependency on a package that is newer than what is declared in `PklProject.deps.json`. Project `file:///$snippetsDir/input/projects/badProjectDeps6/PklProject` declares a dependency on a package that is newer than what is declared in `PklProject.deps.json`.
Declared: `package://localhost:12110/birds@0.8.0` Declared: `package://localhost:0/birds@0.8.0`
Resolved: `package://localhost:12110/birds@0.5.0` Resolved: `package://localhost:0/birds@0.5.0`
Run `pkl project resolve` to update resolved dependencies. Run `pkl project resolve` to update resolved dependencies.
@@ -1,9 +1,9 @@
–– Pkl Error –– –– Pkl Error ––
Cannot find dependency named `fruits`, because it was not declared in package `package://localhost:12110/badImportsWithinPackage@1.0.0`. Cannot find dependency named `fruits`, because it was not declared in package `package://localhost:0/badImportsWithinPackage@1.0.0`.
x | res = import("@fruits/Foo.pkl") x | res = import("@fruits/Foo.pkl")
^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^
at badImport3.error#res (projectpackage://localhost:12110/badImportsWithinPackage@1.0.0#/unknownDependency.pkl) at badImport3.error#res (projectpackage://localhost:0/badImportsWithinPackage@1.0.0#/unknownDependency.pkl)
xxx | text = renderer.renderDocument(value) xxx | text = renderer.renderDocument(value)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -38,7 +38,7 @@ examples {
} }
["reading directories"] { ["reading directories"] {
new { new {
uri = "projectpackage://localhost:12110/birds@0.5.0#/catalog" uri = "projectpackage://localhost:0/birds@0.5.0#/catalog"
text = """ text = """
Ostritch.pkl Ostritch.pkl
Swallow.pkl Swallow.pkl
@@ -47,7 +47,7 @@ examples {
base64 = "T3N0cml0Y2gucGtsClN3YWxsb3cucGtsCg==" base64 = "T3N0cml0Y2gucGtsClN3YWxsb3cucGtsCg=="
} }
new { new {
uri = "projectpackage://localhost:12110/birds@0.5.0#/" uri = "projectpackage://localhost:0/birds@0.5.0#/"
text = """ text = """
Bird.pkl Bird.pkl
allFruit.pkl allFruit.pkl
@@ -1,5 +1,5 @@
–– Pkl Error –– –– Pkl Error ––
I/O error loading module `projectpackage://localhost:12110/birds@0.5.0#/`. I/O error loading module `projectpackage://localhost:0/birds@0.5.0#/`.
IOException: Is a directory IOException: Is a directory
x | res = import("@birds") x | res = import("@birds")
@@ -17,13 +17,13 @@ examples {
} }
["glob-import absolute package uri"] { ["glob-import absolute package uri"] {
new { new {
["package://localhost:12110/birds@0.5.0#/catalog/Ostritch.pkl"] { ["package://localhost:0/birds@0.5.0#/catalog/Ostritch.pkl"] {
name = "Ostritch" name = "Ostritch"
favoriteFruit { favoriteFruit {
name = "Orange" name = "Orange"
} }
} }
["package://localhost:12110/birds@0.5.0#/catalog/Swallow.pkl"] { ["package://localhost:0/birds@0.5.0#/catalog/Swallow.pkl"] {
name = "Swallow" name = "Swallow"
favoriteFruit { favoriteFruit {
name = "Apple" name = "Apple"
@@ -42,7 +42,7 @@ examples {
["glob-read using dependency notation"] { ["glob-read using dependency notation"] {
new { new {
["@birds/catalog/Ostritch.pkl"] { ["@birds/catalog/Ostritch.pkl"] {
uri = "projectpackage://localhost:12110/birds@0.5.0#/catalog/Ostritch.pkl" uri = "projectpackage://localhost:0/birds@0.5.0#/catalog/Ostritch.pkl"
text = """ text = """
amends "../Bird.pkl" amends "../Bird.pkl"
@@ -56,7 +56,7 @@ examples {
base64 = "YW1lbmRzICIuLi9CaXJkLnBrbCIKCm5hbWUgPSAiT3N0cml0Y2giCgpmYXZvcml0ZUZydWl0IHsKICBuYW1lID0gIk9yYW5nZSIKfQo=" base64 = "YW1lbmRzICIuLi9CaXJkLnBrbCIKCm5hbWUgPSAiT3N0cml0Y2giCgpmYXZvcml0ZUZydWl0IHsKICBuYW1lID0gIk9yYW5nZSIKfQo="
} }
["@birds/catalog/Swallow.pkl"] { ["@birds/catalog/Swallow.pkl"] {
uri = "projectpackage://localhost:12110/birds@0.5.0#/catalog/Swallow.pkl" uri = "projectpackage://localhost:0/birds@0.5.0#/catalog/Swallow.pkl"
text = """ text = """
amends "../Bird.pkl" amends "../Bird.pkl"
@@ -72,7 +72,7 @@ examples {
} }
new { new {
["@birds/Bird.pkl"] { ["@birds/Bird.pkl"] {
uri = "projectpackage://localhost:12110/birds@0.5.0#/Bird.pkl" uri = "projectpackage://localhost:0/birds@0.5.0#/Bird.pkl"
text = """ text = """
open module birds.Bird open module birds.Bird
@@ -86,7 +86,7 @@ examples {
base64 = "b3BlbiBtb2R1bGUgYmlyZHMuQmlyZAoKaW1wb3J0ICJAZnJ1aXRpZXMvRnJ1aXQucGtsIgoKbmFtZTogU3RyaW5nCgpmYXZvcml0ZUZydWl0OiBGcnVpdAo=" base64 = "b3BlbiBtb2R1bGUgYmlyZHMuQmlyZAoKaW1wb3J0ICJAZnJ1aXRpZXMvRnJ1aXQucGtsIgoKbmFtZTogU3RyaW5nCgpmYXZvcml0ZUZydWl0OiBGcnVpdAo="
} }
["@birds/allFruit.pkl"] { ["@birds/allFruit.pkl"] {
uri = "projectpackage://localhost:12110/birds@0.5.0#/allFruit.pkl" uri = "projectpackage://localhost:0/birds@0.5.0#/allFruit.pkl"
text = """ text = """
module birds.allFruit module birds.allFruit
@@ -97,7 +97,7 @@ examples {
base64 = "bW9kdWxlIGJpcmRzLmFsbEZydWl0CgpmcnVpdCA9IGltcG9ydCooIkBmcnVpdGllcy9jYXRhbG9nLyoucGtsIikKZnJ1aXRGaWxlcyA9IHJlYWQqKCJAZnJ1aXRpZXMvY2F0YWxvZy8qLnBrbCIpCg==" base64 = "bW9kdWxlIGJpcmRzLmFsbEZydWl0CgpmcnVpdCA9IGltcG9ydCooIkBmcnVpdGllcy9jYXRhbG9nLyoucGtsIikKZnJ1aXRGaWxlcyA9IHJlYWQqKCJAZnJ1aXRpZXMvY2F0YWxvZy8qLnBrbCIpCg=="
} }
["@birds/catalog.pkl"] { ["@birds/catalog.pkl"] {
uri = "projectpackage://localhost:12110/birds@0.5.0#/catalog.pkl" uri = "projectpackage://localhost:0/birds@0.5.0#/catalog.pkl"
text = """ text = """
module birds.catalog module birds.catalog
@@ -110,7 +110,7 @@ examples {
} }
new { new {
["@birds/Bird.pkl"] { ["@birds/Bird.pkl"] {
uri = "projectpackage://localhost:12110/birds@0.5.0#/Bird.pkl" uri = "projectpackage://localhost:0/birds@0.5.0#/Bird.pkl"
text = """ text = """
open module birds.Bird open module birds.Bird
@@ -124,7 +124,7 @@ examples {
base64 = "b3BlbiBtb2R1bGUgYmlyZHMuQmlyZAoKaW1wb3J0ICJAZnJ1aXRpZXMvRnJ1aXQucGtsIgoKbmFtZTogU3RyaW5nCgpmYXZvcml0ZUZydWl0OiBGcnVpdAo=" base64 = "b3BlbiBtb2R1bGUgYmlyZHMuQmlyZAoKaW1wb3J0ICJAZnJ1aXRpZXMvRnJ1aXQucGtsIgoKbmFtZTogU3RyaW5nCgpmYXZvcml0ZUZydWl0OiBGcnVpdAo="
} }
["@birds/allFruit.pkl"] { ["@birds/allFruit.pkl"] {
uri = "projectpackage://localhost:12110/birds@0.5.0#/allFruit.pkl" uri = "projectpackage://localhost:0/birds@0.5.0#/allFruit.pkl"
text = """ text = """
module birds.allFruit module birds.allFruit
@@ -135,7 +135,7 @@ examples {
base64 = "bW9kdWxlIGJpcmRzLmFsbEZydWl0CgpmcnVpdCA9IGltcG9ydCooIkBmcnVpdGllcy9jYXRhbG9nLyoucGtsIikKZnJ1aXRGaWxlcyA9IHJlYWQqKCJAZnJ1aXRpZXMvY2F0YWxvZy8qLnBrbCIpCg==" base64 = "bW9kdWxlIGJpcmRzLmFsbEZydWl0CgpmcnVpdCA9IGltcG9ydCooIkBmcnVpdGllcy9jYXRhbG9nLyoucGtsIikKZnJ1aXRGaWxlcyA9IHJlYWQqKCJAZnJ1aXRpZXMvY2F0YWxvZy8qLnBrbCIpCg=="
} }
["@birds/catalog.pkl"] { ["@birds/catalog.pkl"] {
uri = "projectpackage://localhost:12110/birds@0.5.0#/catalog.pkl" uri = "projectpackage://localhost:0/birds@0.5.0#/catalog.pkl"
text = """ text = """
module birds.catalog module birds.catalog
@@ -146,7 +146,7 @@ examples {
base64 = "bW9kdWxlIGJpcmRzLmNhdGFsb2cKCmNhdGFsb2cgPSBpbXBvcnQqKCJjYXRhbG9nLyoucGtsIikKY2F0YWxvZ0ZpbGVzID0gcmVhZCooImNhdGFsb2cvKi5wa2wiKQo=" base64 = "bW9kdWxlIGJpcmRzLmNhdGFsb2cKCmNhdGFsb2cgPSBpbXBvcnQqKCJjYXRhbG9nLyoucGtsIikKY2F0YWxvZ0ZpbGVzID0gcmVhZCooImNhdGFsb2cvKi5wa2wiKQo="
} }
["@birds/catalog/Ostritch.pkl"] { ["@birds/catalog/Ostritch.pkl"] {
uri = "projectpackage://localhost:12110/birds@0.5.0#/catalog/Ostritch.pkl" uri = "projectpackage://localhost:0/birds@0.5.0#/catalog/Ostritch.pkl"
text = """ text = """
amends "../Bird.pkl" amends "../Bird.pkl"
@@ -160,7 +160,7 @@ examples {
base64 = "YW1lbmRzICIuLi9CaXJkLnBrbCIKCm5hbWUgPSAiT3N0cml0Y2giCgpmYXZvcml0ZUZydWl0IHsKICBuYW1lID0gIk9yYW5nZSIKfQo=" base64 = "YW1lbmRzICIuLi9CaXJkLnBrbCIKCm5hbWUgPSAiT3N0cml0Y2giCgpmYXZvcml0ZUZydWl0IHsKICBuYW1lID0gIk9yYW5nZSIKfQo="
} }
["@birds/catalog/Swallow.pkl"] { ["@birds/catalog/Swallow.pkl"] {
uri = "projectpackage://localhost:12110/birds@0.5.0#/catalog/Swallow.pkl" uri = "projectpackage://localhost:0/birds@0.5.0#/catalog/Swallow.pkl"
text = """ text = """
amends "../Bird.pkl" amends "../Bird.pkl"
@@ -174,7 +174,7 @@ examples {
base64 = "YW1lbmRzICIuLi9CaXJkLnBrbCIKCmltcG9ydCAiQGZydWl0aWVzL2NhdGFsb2cvYXBwbGUucGtsIgoKbmFtZSA9ICJTd2FsbG93IgoKZmF2b3JpdGVGcnVpdCA9IGFwcGxlCg==" base64 = "YW1lbmRzICIuLi9CaXJkLnBrbCIKCmltcG9ydCAiQGZydWl0aWVzL2NhdGFsb2cvYXBwbGUucGtsIgoKbmFtZSA9ICJTd2FsbG93IgoKZmF2b3JpdGVGcnVpdCA9IGFwcGxlCg=="
} }
["@birds/some/dir/Bird.pkl"] { ["@birds/some/dir/Bird.pkl"] {
uri = "projectpackage://localhost:12110/birds@0.5.0#/some/dir/Bird.pkl" uri = "projectpackage://localhost:0/birds@0.5.0#/some/dir/Bird.pkl"
text = """ text = """
amends "..." amends "..."
@@ -192,7 +192,7 @@ examples {
["glob-read within package"] { ["glob-read within package"] {
new { new {
["catalog/Ostritch.pkl"] { ["catalog/Ostritch.pkl"] {
uri = "projectpackage://localhost:12110/birds@0.5.0#/catalog/Ostritch.pkl" uri = "projectpackage://localhost:0/birds@0.5.0#/catalog/Ostritch.pkl"
text = """ text = """
amends "../Bird.pkl" amends "../Bird.pkl"
@@ -206,7 +206,7 @@ examples {
base64 = "YW1lbmRzICIuLi9CaXJkLnBrbCIKCm5hbWUgPSAiT3N0cml0Y2giCgpmYXZvcml0ZUZydWl0IHsKICBuYW1lID0gIk9yYW5nZSIKfQo=" base64 = "YW1lbmRzICIuLi9CaXJkLnBrbCIKCm5hbWUgPSAiT3N0cml0Y2giCgpmYXZvcml0ZUZydWl0IHsKICBuYW1lID0gIk9yYW5nZSIKfQo="
} }
["catalog/Swallow.pkl"] { ["catalog/Swallow.pkl"] {
uri = "projectpackage://localhost:12110/birds@0.5.0#/catalog/Swallow.pkl" uri = "projectpackage://localhost:0/birds@0.5.0#/catalog/Swallow.pkl"
text = """ text = """
amends "../Bird.pkl" amends "../Bird.pkl"
@@ -223,8 +223,8 @@ examples {
} }
["glob-read absolute package uri"] { ["glob-read absolute package uri"] {
new { new {
["package://localhost:12110/birds@0.5.0#/catalog/Ostritch.pkl"] { ["package://localhost:0/birds@0.5.0#/catalog/Ostritch.pkl"] {
uri = "package://localhost:12110/birds@0.5.0#/catalog/Ostritch.pkl" uri = "package://localhost:0/birds@0.5.0#/catalog/Ostritch.pkl"
text = """ text = """
amends "../Bird.pkl" amends "../Bird.pkl"
@@ -237,8 +237,8 @@ examples {
""" """
base64 = "YW1lbmRzICIuLi9CaXJkLnBrbCIKCm5hbWUgPSAiT3N0cml0Y2giCgpmYXZvcml0ZUZydWl0IHsKICBuYW1lID0gIk9yYW5nZSIKfQo=" base64 = "YW1lbmRzICIuLi9CaXJkLnBrbCIKCm5hbWUgPSAiT3N0cml0Y2giCgpmYXZvcml0ZUZydWl0IHsKICBuYW1lID0gIk9yYW5nZSIKfQo="
} }
["package://localhost:12110/birds@0.5.0#/catalog/Swallow.pkl"] { ["package://localhost:0/birds@0.5.0#/catalog/Swallow.pkl"] {
uri = "package://localhost:12110/birds@0.5.0#/catalog/Swallow.pkl" uri = "package://localhost:0/birds@0.5.0#/catalog/Swallow.pkl"
text = """ text = """
amends "../Bird.pkl" amends "../Bird.pkl"
@@ -17,7 +17,7 @@ class StackFrameTransformersTest {
.setHttpClient(httpClient) .setHttpClient(httpClient)
.build().use { .build().use {
val frame = StackFrame( val frame = StackFrame(
"package://localhost:12110/birds@0.5.0#/Bird.pkl", "package://localhost:0/birds@0.5.0#/Bird.pkl",
null, null,
listOf(), listOf(),
1, 1,
@@ -104,10 +104,10 @@ class RequestRewritingClientTest {
} }
@Test @Test
fun `rewrites port 12110 if test port is set`() { fun `rewrites port 0 if test port is set`() {
val captured = RequestCapturingClient() val captured = RequestCapturingClient()
val client = RequestRewritingClient("Pkl", Duration.ofSeconds(42), 5000, captured) val client = RequestRewritingClient("Pkl", Duration.ofSeconds(42), 5000, captured)
val request = HttpRequest.newBuilder(URI("https://example.com:12110")).build() val request = HttpRequest.newBuilder(URI("https://example.com:0")).build()
client.send(request, BodyHandlers.discarding()) client.send(request, BodyHandlers.discarding())
@@ -115,12 +115,12 @@ class RequestRewritingClientTest {
} }
@Test @Test
fun `leaves port 12110 intact if no test port is set`() { fun `leaves port 0 intact if no test port is set`() {
val request = HttpRequest.newBuilder(URI("https://example.com:12110")).build() val request = HttpRequest.newBuilder(URI("https://example.com:0")).build()
client.send(request, BodyHandlers.discarding()) client.send(request, BodyHandlers.discarding())
assertThat(captured.request.uri().port).isEqualTo(12110) assertThat(captured.request.uri().port).isEqualTo(0)
} }
} }
@@ -160,7 +160,7 @@ class ModuleKeysTest {
@Test @Test
fun `package - no version`() { fun `package - no version`() {
val e = assertThrows<URISyntaxException> { val e = assertThrows<URISyntaxException> {
ModuleKeys.pkg(URI("package://localhost:12110/birds#/Bird.pkl")) ModuleKeys.pkg(URI("package://localhost:0/birds#/Bird.pkl"))
} }
assertThat(e).hasMessageContaining("A package URI must have its path suffixed by its version") assertThat(e).hasMessageContaining("A package URI must have its path suffixed by its version")
} }
@@ -168,7 +168,7 @@ class ModuleKeysTest {
@Test @Test
fun `package - invalid semver`() { fun `package - invalid semver`() {
val e = assertThrows<URISyntaxException> { val e = assertThrows<URISyntaxException> {
ModuleKeys.pkg(URI("package://localhost:12110/birds@notAVersion#/Bird.pkl")) ModuleKeys.pkg(URI("package://localhost:0/birds@notAVersion#/Bird.pkl"))
} }
assertThat(e).hasMessageContaining("`notAVersion` could not be parsed") assertThat(e).hasMessageContaining("`notAVersion` could not be parsed")
} }
@@ -47,7 +47,7 @@ class PackageResolversTest {
@Test @Test
fun `get module bytes`() { fun `get module bytes`() {
val expectedBirdModule = packageRoot.resolve("birds@0.5.0/package/Bird.pkl").readString(StandardCharsets.UTF_8) val expectedBirdModule = packageRoot.resolve("birds@0.5.0/package/Bird.pkl").readString(StandardCharsets.UTF_8)
val assetUri = PackageAssetUri("package://localhost:12110/birds@0.5.0#/Bird.pkl") val assetUri = PackageAssetUri("package://localhost:0/birds@0.5.0#/Bird.pkl")
val birdModule = resolver val birdModule = resolver
.getBytes(assetUri, false, null) .getBytes(assetUri, false, null)
.toString(StandardCharsets.UTF_8) .toString(StandardCharsets.UTF_8)
@@ -56,7 +56,7 @@ class PackageResolversTest {
@Test @Test
fun `get directory`() { fun `get directory`() {
val assetUri = PackageAssetUri("package://localhost:12110/birds@0.5.0#/") val assetUri = PackageAssetUri("package://localhost:0/birds@0.5.0#/")
val err = assertThrows<IOException> { val err = assertThrows<IOException> {
resolver resolver
.getBytes(assetUri, false, null) .getBytes(assetUri, false, null)
@@ -67,7 +67,7 @@ class PackageResolversTest {
@Test @Test
fun `get directory, allowing directory reads`() { fun `get directory, allowing directory reads`() {
val assetUri = PackageAssetUri("package://localhost:12110/birds@0.5.0#/") val assetUri = PackageAssetUri("package://localhost:0/birds@0.5.0#/")
val bytes = resolver val bytes = resolver
.getBytes(assetUri, true, null) .getBytes(assetUri, true, null)
.toString(StandardCharsets.UTF_8) .toString(StandardCharsets.UTF_8)
@@ -84,7 +84,7 @@ class PackageResolversTest {
@Test @Test
fun `get module bytes resolving path`() { fun `get module bytes resolving path`() {
val expectedBirdModule = packageRoot.resolve("birds@0.5.0/package/Bird.pkl").readString(StandardCharsets.UTF_8) val expectedBirdModule = packageRoot.resolve("birds@0.5.0/package/Bird.pkl").readString(StandardCharsets.UTF_8)
val assetUri = PackageAssetUri("package://localhost:12110/birds@0.5.0#/foo/../Bird.pkl") val assetUri = PackageAssetUri("package://localhost:0/birds@0.5.0#/foo/../Bird.pkl")
val birdModule = resolver val birdModule = resolver
.getBytes(assetUri, false, null) .getBytes(assetUri, false, null)
.toString(StandardCharsets.UTF_8) .toString(StandardCharsets.UTF_8)
@@ -95,7 +95,7 @@ class PackageResolversTest {
fun `list path elements at root`() { fun `list path elements at root`() {
// cast to set to avoid sort issues // cast to set to avoid sort issues
val elements = resolver val elements = resolver
.listElements(PackageAssetUri("package://localhost:12110/birds@0.5.0#/"), null) .listElements(PackageAssetUri("package://localhost:0/birds@0.5.0#/"), null)
.toSet() .toSet()
assertThat(elements).isEqualTo( assertThat(elements).isEqualTo(
setOf( setOf(
@@ -111,12 +111,12 @@ class PackageResolversTest {
@Test @Test
fun `get multiple assets`() { fun `get multiple assets`() {
val bird = resolver.getBytes( val bird = resolver.getBytes(
PackageAssetUri("package://localhost:12110/birds@0.5.0#/Bird.pkl"), PackageAssetUri("package://localhost:0/birds@0.5.0#/Bird.pkl"),
false, false,
null null
) )
val swallow = resolver.getBytes( val swallow = resolver.getBytes(
PackageAssetUri("package://localhost:12110/birds@0.5.0#/catalog/Swallow.pkl"), PackageAssetUri("package://localhost:0/birds@0.5.0#/catalog/Swallow.pkl"),
false, false,
null null
) )
@@ -127,7 +127,7 @@ class PackageResolversTest {
@Test @Test
fun `list path elements in nested directory`() { fun `list path elements in nested directory`() {
// cast to set to avoid sort issues // cast to set to avoid sort issues
val elements = resolver.listElements(PackageAssetUri("package://localhost:12110/birds@0.5.0#/catalog/"), null).toSet() val elements = resolver.listElements(PackageAssetUri("package://localhost:0/birds@0.5.0#/catalog/"), null).toSet()
assertThat(elements).isEqualTo( assertThat(elements).isEqualTo(
setOf( setOf(
PathElement("Ostritch.pkl", false), PathElement("Ostritch.pkl", false),
@@ -141,7 +141,7 @@ class PackageResolversTest {
assertThrows<FileNotFoundException> { assertThrows<FileNotFoundException> {
resolver resolver
.getBytes( .getBytes(
PackageAssetUri("package://localhost:12110/birds@0.5.0#/Horse.pkl"), PackageAssetUri("package://localhost:0/birds@0.5.0#/Horse.pkl"),
false, false,
null null
) )
@@ -154,7 +154,7 @@ class PackageResolversTest {
assertThrows<PackageLoadError> { assertThrows<PackageLoadError> {
resolver resolver
.getBytes( .getBytes(
PackageAssetUri("package://localhost:12110/not-a-package@0.5.0#/Horse.pkl"), PackageAssetUri("package://localhost:0/not-a-package@0.5.0#/Horse.pkl"),
false, false,
null) null)
.toString(StandardCharsets.UTF_8) .toString(StandardCharsets.UTF_8)
@@ -165,18 +165,18 @@ class PackageResolversTest {
fun `requires package zip to be an HTTPS URI`() { fun `requires package zip to be an HTTPS URI`() {
assertThatCode { assertThatCode {
resolver.getBytes( resolver.getBytes(
PackageAssetUri("package://localhost:12110/badPackageZipUrl@1.0.0#/Bug.pkl"), PackageAssetUri("package://localhost:0/badPackageZipUrl@1.0.0#/Bug.pkl"),
false, false,
null) null)
} }
.hasMessage("Expected the zip asset for package `package://localhost:12110/badPackageZipUrl@1.0.0` to be an HTTPS URI, but got `ftp://wait/a/minute`.") .hasMessage("Expected the zip asset for package `package://localhost:0/badPackageZipUrl@1.0.0` to be an HTTPS URI, but got `ftp://wait/a/minute`.")
} }
@Test @Test
fun `throws if package checksum is invalid`() { fun `throws if package checksum is invalid`() {
val error = assertThrows<PackageLoadError> { val error = assertThrows<PackageLoadError> {
resolver.getBytes( resolver.getBytes(
PackageAssetUri("package://localhost:12110/badChecksum@1.0.0#/Bug.pkl"), PackageAssetUri("package://localhost:0/badChecksum@1.0.0#/Bug.pkl"),
false, false,
null) null)
} }
@@ -46,23 +46,23 @@ class ProjectDependenciesResolverTest {
{ {
"schemaVersion": 1, "schemaVersion": 1,
"resolvedDependencies": { "resolvedDependencies": {
"package://localhost:12110/birds@0": { "package://localhost:0/birds@0": {
"type": "remote", "type": "remote",
"uri": "projectpackage://localhost:12110/birds@0.5.0", "uri": "projectpackage://localhost:0/birds@0.5.0",
"checksums": { "checksums": {
"sha256": "0a5ad2dc13f06f73f96ba94e8d01d48252bc934e2de71a837620ca0fef8a7453" "sha256": "${PackageServer.BIRDS_SHA}"
} }
}, },
"package://localhost:12110/fruit@1": { "package://localhost:0/fruit@1": {
"type": "remote", "type": "remote",
"uri": "projectpackage://localhost:12110/fruit@1.1.0", "uri": "projectpackage://localhost:0/fruit@1.1.0",
"checksums": { "checksums": {
"sha256": "a82e92e0c259591111d09d18a14f5ad66e2b6e13d827ee3e6f7ce06f5d0fbe0c" "sha256": "${PackageServer.FRUIT_1_1_SHA}"
} }
}, },
"package://localhost:12110/project3@1": { "package://localhost:0/project3@1": {
"type": "local", "type": "local",
"uri": "projectpackage://localhost:12110/project3@1.5.0", "uri": "projectpackage://localhost:0/project3@1.5.0",
"path": "../project3" "path": "../project3"
} }
} }
@@ -79,9 +79,9 @@ class ProjectDependenciesResolverTest {
ProjectDependenciesResolver(project, packageResolver, System.err.writer()).resolve() ProjectDependenciesResolver(project, packageResolver, System.err.writer()).resolve()
} }
assertThat(e).hasMessage(""" assertThat(e).hasMessage("""
Computed checksum did not match declared checksum for dependency `package://localhost:12110/birds@0.5.0`. Computed checksum did not match declared checksum for dependency `package://localhost:0/birds@0.5.0`.
Computed: "0a5ad2dc13f06f73f96ba94e8d01d48252bc934e2de71a837620ca0fef8a7453" Computed: "${PackageServer.BIRDS_SHA}"
Declared: "intentionally bogus value" Declared: "intentionally bogus value"
""".trimIndent()) """.trimIndent())
} }
@@ -14,16 +14,16 @@ class ProjectDepsTest {
{ {
"schemaVersion": 1, "schemaVersion": 1,
"resolvedDependencies": { "resolvedDependencies": {
"package://localhost:12110/birds@0": { "package://localhost:0/birds@0": {
"type": "remote", "type": "remote",
"uri": "package://localhost:12110/birds@0.5.0", "uri": "package://localhost:0/birds@0.5.0",
"checksums": { "checksums": {
"sha256": "abc123" "sha256": "abc123"
} }
}, },
"package://localhost:12110/fruit@1": { "package://localhost:0/fruit@1": {
"type": "local", "type": "local",
"uri": "package://localhost:12110/fruit@1.1.0", "uri": "package://localhost:0/fruit@1.1.0",
"path": "../fruit" "path": "../fruit"
} }
} }
@@ -32,12 +32,12 @@ class ProjectDepsTest {
private val projectDeps = let { private val projectDeps = let {
val projectDepsMap = EconomicMaps.of<CanonicalPackageUri, Dependency>( val projectDepsMap = EconomicMaps.of<CanonicalPackageUri, Dependency>(
CanonicalPackageUri.of("package://localhost:12110/birds@0"), Dependency.RemoteDependency( CanonicalPackageUri.of("package://localhost:0/birds@0"), Dependency.RemoteDependency(
PackageUri.create("package://localhost:12110/birds@0.5.0"), PackageUri.create("package://localhost:0/birds@0.5.0"),
Checksums("abc123") Checksums("abc123")
), ),
CanonicalPackageUri.of("package://localhost:12110/fruit@1"), Dependency.LocalDependency( CanonicalPackageUri.of("package://localhost:0/fruit@1"), Dependency.LocalDependency(
PackageUri.create("package://localhost:12110/fruit@1.1.0"), PackageUri.create("package://localhost:0/fruit@1.1.0"),
Path.of("../fruit") Path.of("../fruit")
) )
) )
@@ -151,11 +151,11 @@ class ProjectTest {
assertThatCode { evaluator.evaluate(ModuleSource.path(projectDir.resolve("bug.pkl"))) } assertThatCode { evaluator.evaluate(ModuleSource.path(projectDir.resolve("bug.pkl"))) }
.hasMessageStartingWith(""" .hasMessageStartingWith("""
–– Pkl Error –– –– Pkl Error ––
Cannot download package `package://localhost:12110/fruit@1.0.5` because the computed checksum for package metadata does not match the expected checksum. Cannot download package `package://localhost:0/fruit@1.0.5` because the computed checksum for package metadata does not match the expected checksum.
Computed checksum: "abd173e8a25f5b930b0e34269a441e32c9d95e0b0a715bc6eff918f0afd0688e" Computed checksum: "${PackageServer.FRUIT_SHA}"
Expected checksum: "intentionally bogus checksum" Expected checksum: "intentionally bogus checksum"
Asset URL: "https://localhost:12110/fruit@1.0.5" Asset URL: "https://localhost:0/fruit@1.0.5"
1 | import "@fruit/Fruit.pkl" 1 | import "@fruit/Fruit.pkl"
^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -2,7 +2,7 @@ amends "pkl:Project"
dependencies { dependencies {
["birds"] { ["birds"] {
uri = "package://localhost:12110/birds@0.5.0" uri = "package://localhost:0/birds@0.5.0"
checksums { checksums {
sha256 = "intentionally bogus value" sha256 = "intentionally bogus value"
} }
@@ -3,6 +3,6 @@ amends "pkl:Project"
dependencies { dependencies {
["fruit"] { ["fruit"] {
// should fail because the checksum is invalid // should fail because the checksum is invalid
uri = "package://localhost:12110/fruit@1.0.5" uri = "package://localhost:0/fruit@1.0.5"
} }
} }
@@ -1,9 +1,9 @@
{ {
"schemaVersion": 1, "schemaVersion": 1,
"resolvedDependencies": { "resolvedDependencies": {
"package://localhost:12110/fruit@1": { "package://localhost:0/fruit@1": {
"type": "remote", "type": "remote",
"uri": "projectpackage://localhost:12110/fruit@1.0.5", "uri": "projectpackage://localhost:0/fruit@1.0.5",
"checksums": { "checksums": {
"sha256": "intentionally bogus checksum" "sha256": "intentionally bogus checksum"
} }
@@ -2,7 +2,7 @@ amends "pkl:Project"
dependencies { dependencies {
["birds"] { ["birds"] {
uri = "package://localhost:12110/birds@0.5.0" uri = "package://localhost:0/birds@0.5.0"
} }
["project3"] = import("../project3/PklProject") ["project3"] = import("../project3/PklProject")
} }
@@ -2,7 +2,7 @@ amends "pkl:Project"
package { package {
name = "project3" name = "project3"
baseUri = "package://localhost:12110/project3" baseUri = "package://localhost:0/project3"
version = "1.5.0" version = "1.5.0"
// not actually used, just need to provide one so tests pass // not actually used, just need to provide one so tests pass
packageZipUrl = "https://bogus.value" packageZipUrl = "https://bogus.value"
@@ -10,6 +10,6 @@ package {
dependencies { dependencies {
["fruit"] { ["fruit"] {
uri = "package://localhost:12110/fruit@1.1.0" uri = "package://localhost:0/fruit@1.1.0"
} }
} }
@@ -4,5 +4,5 @@ package {
name = "project4" name = "project4"
version = "1.0.0" version = "1.0.0"
packageZipUrl = "https://bogus.value" packageZipUrl = "https://bogus.value"
baseUri = "package://localhost:12110/project4" baseUri = "package://localhost:0/project4"
} }

Some files were not shown because too many files have changed in this diff Show More