Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@maks-rafalko
Copy link
Member

My goal is to update CONTRIBUTION.md guide to explain how Infection should be developed and checked/tested for contributors, because this file is outdated.

During analyzing it, I found that our makefile docker commands are broken, so I want to make them work, at least the most useful ones:

  • make autoreview-docker
  • make test-unit-docker
  • make cs-docker

];
}

public function test_all_docker_test_targets_are_properly_declared(): void
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking for ~10 minutes to this test and the second one that is removed, I didn't get it and it looks like it works incorrectly making incorrect assumption regarding targets naming.

@theofidry do you have any idea what does it do and why it fails with the current Makefile?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll comment in each tests

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test ensures that we follow the pattern that for each phony target test-*-docker, it contains all test-*-*-docker.

For instance:

  • test-docker contains test-unit-docker, test-e2e-docker and test-infection-docker.
  • test-unit-docker contains test-unit-82-docker, test-unit-83-docker, etc.

Copy link
Member

@theofidry theofidry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@maks-rafalko I couldn't check which ones were failing, but IIRC there was some hardcoding to deal with autoreview that was not really following the conventions at that time

-type f \
-not -name "*.cache" \
-not -name "*.log" \
-not -path "./.DS_Store" \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it really related?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well, implicitly, without this make autoreview-docker doesn't pass

];
}

public function test_all_docker_test_targets_are_properly_declared(): void
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll comment in each tests

$this->assertEqualsCanonicalizing($rootTestTargets, $testPrerequisites);
}

public function test_the_docker_test_target_runs_all_the_tests(): void
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test was to ensure the (phony) test-docker executes all (phony) tests, i.e. thattest-docker executes:

  • autoreview
  • test-unit-docker
  • test-e2e-docker
  • test-infection-docker
  • and if added any test-x-docker

$testRules = self::getTestRules(true);

// Exclude itself
$testPrerequisites = array_shift($testRules)->getPrerequisites();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is getting all the pre-requesites of test-docker

// Exclude itself
$testPrerequisites = array_shift($testRules)->getPrerequisites();

$rootTestTargets = self::getRootTestTargets($testRules, 2);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is getting all the test-*-* (phony) targets

];
}

public function test_all_docker_test_targets_are_properly_declared(): void
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test ensures that we follow the pattern that for each phony target test-*-docker, it contains all test-*-*-docker.

For instance:

  • test-docker contains test-unit-docker, test-e2e-docker and test-infection-docker.
  • test-unit-docker contains test-unit-82-docker, test-unit-83-docker, etc.

@theofidry
Copy link
Member

If I may, I think part of the confusion is that this PR does two things:

  • move some targets that were not previously ran in docker in docker (the title matches this)
  • remove some docker targets*

*: previously we had for instance test-unit-docker that was executing test-unit-82-docker & test-unit-83-docker. At some point one of those was removed and we didn't add 8.4, I can't remember if this was a conscious decision to simply things or if it just happened as we dropped PHP 8.2 support.

In any case, removing test-unit-82-docker in favour of test-unit-docker (and similarly for others) likely requires some changes in that test.

@maks-rafalko
Copy link
Member Author

for some reason I can't comment under you comment, so will leave here:

This test ensures that we follow the pattern that for each phony target test--docker, it contains all test--*-docker.

here is the problem I think, because we have autoreview (cs, phpstan, etc.) and it's pair autoreview-docker.

At the same time we have test-autoreview (which runs PHPUnit with autoreview group) and its par test-autoreview-docker.

So this convention is not followed. We should either rename autoreview command to something else or update/remove this test?

@maks-rafalko
Copy link
Member Author

At some point one of those was removed and we didn't add 8.4, I can't remember if this was a conscious decision to simply things or if it just happened as we dropped PHP 8.2 support.

I don't think we need all the supported versions to be tested locally, we have CI for that.

My goal is simple - to have dockerized targets only for "base" supported version, which is 8.2 atm.

This is needed e.g. for those who don't have 8.2 installed locally (like me)

@theofidry
Copy link
Member

I am just pointing out it didn't use to be like that hence the conventions, because we didn't want that if we add test-unit-84-docker, that we do not forget to add it to test-unit-docker.

I agree with the simplification though, IMO if you hit an issue with a specific version, it shouldn't be hard to adjust the PHP docker image used locally to run the same command as the makefile, or even change the makefile temporarily

@theofidry
Copy link
Member

So this convention is not followed. We should either rename autoreview command to something else or update/remove this test?

I think it's fine to update the test, the test already had a special case handling for autoreview anyway

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants