Skip to content

Commit

Permalink
Drop spawned web server in Composer repository tests
Browse files Browse the repository at this point in the history
Since Composer 2.6, relative local paths are possible for repositories of type composer: composer/composer#11526
  • Loading branch information
dzuelke committed Nov 28, 2023
1 parent 2d6f4b7 commit 5a8ceb9
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: "8.1"
tools: "composer:2.4"
tools: "composer:2.6"
- name: Hatchet setup
run: bundle exec hatchet ci:setup
- name: Export HEROKU_PHP_PLATFORM_REPOSITORIES to …-develop (since we are not building main or a tag)
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/platform/repository/futurepaks/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
},
{
"type": "composer",
"url": "http://localhost:8080/packages.json"
"url": "./packages.json"
},
{
"type": "package",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@
},
{
"type": "composer",
"url": "http://localhost:8080/packages-custom.json",
"url": "./packages-custom.json",
"canonical": false
},
{
"type": "composer",
"url": "http://localhost:8080/packages.json"
"url": "./packages.json"
},
{
"type": "package",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@
},
{
"type": "composer",
"url": "http://localhost:8080/packages-custom.json"
"url": "./packages-custom.json"
},
{
"type": "composer",
"url": "http://localhost:8080/packages.json"
"url": "./packages.json"
},
{
"type": "package",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@
},
{
"type": "composer",
"url": "http://localhost:8080/packages-custom.json",
"url": "./packages-custom.json",
"exclude": ["heroku-sys/ext-redis"]
},
{
"type": "composer",
"url": "http://localhost:8080/packages.json"
"url": "./packages.json"
},
{
"type": "package",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@
},
{
"type": "composer",
"url": "http://localhost:8080/packages-custom.json",
"url": "./packages-custom.json",
"only": ["heroku-sys/ext-igbinary"]
},
{
"type": "composer",
"url": "http://localhost:8080/packages.json"
"url": "./packages.json"
},
{
"type": "package",
Expand Down
12 changes: 0 additions & 12 deletions test/spec/platform_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -142,17 +142,8 @@
end

describe "Repository" do
after(:each) do
Process.kill("TERM", @pid)
Process.wait(@pid)
end

it "can hold packages compatible with future versions of the buildpack the current version will ignore" do
Dir.chdir("test/fixtures/platform/repository/futurepaks") do |cwd|
# we spawn a web server that serves packages.json, like a real composer repository
# this is to ensure that Composer really uses ComposerRepository behavior for provide/replace declarations
@pid = spawn("php -S localhost:8080")

cmd = "composer install --dry-run"
stdout, stderr, status = Open3.capture3("bash -c #{Shellwords.escape(cmd)}")
expect(status.exitstatus).to eq(0), "dry run install failed, stderr: #{stderr}, stdout: #{stdout}"
Expand All @@ -164,9 +155,6 @@

it "combined with a custom repository installs packages from that repo according to the priority given" do
Dir.chdir("test/fixtures/platform/repository/priorities") do |cwd|
# we spawn a web server that serves packages*.json, like a real composer repository
# this is to ensure that Composer really uses ComposerRepository behavior for priorities etc
@pid = spawn("php -S localhost:8080")
Dir.glob("composer-*.json") do |testcase|
cmd = "COMPOSER=#{testcase} composer install --dry-run"
stdout, stderr, status = Open3.capture3("bash -c #{Shellwords.escape(cmd)}")
Expand Down

0 comments on commit 5a8ceb9

Please sign in to comment.