-
-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix test suite #108 #426
Merged
Merged
Fix test suite #108 #426
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
d7debc3
Fix broken test command #108
beesaferoot de38406
refactor broken relation with Asset Model #108
beesaferoot c09ede6
Create test suite workflow #108
beesaferoot a7429fc
fix test suite workflow #108
beesaferoot 6a74e6c
fix test suite workflow #108
beesaferoot 3c67da0
fix test suite workflow #108
beesaferoot 3220bfe
fix test suite workflow #108
beesaferoot 9ff6abe
fix test suite workflow #108
beesaferoot 31615cd
add instruction to run test locally #108
beesaferoot eb4819b
fix lint error #108
beesaferoot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
name: Code Test Suite | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
|
||
jobs: | ||
tests: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
php-version: ["8.2"] | ||
|
||
services: | ||
mariadb: | ||
image: mariadb:10.11 | ||
env: | ||
MYSQL_DATABASE: testing_test_company_db | ||
MYSQL_ROOT_PASSWORD: wF9zLp2qRxaS2e | ||
ports: | ||
- 3306:3306 | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php-version }} | ||
extensions: mbstring, dom, fileinfo, mysql | ||
coverage: xdebug | ||
|
||
- name: Install Composer Dependencies | ||
run: | | ||
composer install --no-interaction --prefer-dist | ||
composer dump-autoload | ||
working-directory: ./src/backend | ||
|
||
# - name: Generate key | ||
# run: php artisan key:generate | ||
# working-directory: ./src/backend | ||
|
||
- name: Run Migrations | ||
run: | | ||
php artisan migrate:fresh --seed | ||
working-directory: ./src/backend | ||
env: | ||
DB_CONNECTION: testing | ||
DB_HOST: 127.0.0.1 | ||
DB_PORT: 3306 | ||
DB_DATABASE: testing_test_company_db | ||
DB_USERNAME: root | ||
DB_PASSWORD: wF9zLp2qRxaS2e | ||
|
||
- name: Execute tests | ||
run: php artisan test | ||
working-directory: ./src/backend | ||
continue-on-error: true | ||
env: | ||
DB_CONNECTION: testing | ||
DB_HOST: 127.0.0.1 | ||
DB_PORT: 3306 | ||
DB_DATABASE: testing_test_company_db | ||
DB_USERNAME: root | ||
DB_PASSWORD: wF9zLp2qRxaS2e |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like that the tests use their own connection (own database yes, but not own connection). We actually have the connection names
micro_power_manager
andshard
hardcoded in a lot of places in the code base. So, I'm doubtful if using different connection names will even work.Do you think it's possible to remove the two testing connections and the envs
DB_CONNECTION
andTEST_DB_CONNECTION
?We could instead use a different
DB_DATABASE
env when running test.However, I'm not sure how many side effects this will have. So, I'd say we move this to a different PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will have to give it a try. It will make things cleaner if we have the same connections