715_Create_tests_roomBooking #1151
No reviewers
Labels
No labels
_CRITICAL_
API
app
backEnd
Blocked, waiting for further changes
bug
cleanup
close
design
duplicate
enhancement
feature request
frontEnd
help wanted
invalid
low priority
needs input
needs review
project documentation
question
research
reviewed
script
security
SQL
style
testing
topLevel
wontfix
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Andras/BoundlessFlowCampus2K!1151
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "715_Create_tests_roomBooking"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Have started on the base for the integration tests for roombooking.
this uses the structure from @a24hirsa tests for energyservice.
did not have the time to make proper test so this is just the base structure for furthure tests.
should work the same as #1113 with the exeption of that it has been modified to work with roombooking
as this is only a start the issue should still be open
Please remember that all the comments will be visible in the git history. Have this in mind when writing both commit messages and comments.
The test executes and I can see the test container in Docker being alive, then dying and the test concluding. I am definitely no expert in this field either, but if this follows the energy service as a template then I'm pretty sure it works as you guys intend.
There is some other issues with the code however, mostly related to the comments. First of all, as Eric mentioned, git history is saved so we should try to avoid leaving... spicy git messages and code comments, as they are saved as history. Try to keep this in mind for future commits, as this is the same on GitHub.
Furthermore:
Changes needed
rebased the branch to both_teams_week_8
Comments are still misspelled and hard to read. See example provided below.
I checked with @a24hirsa to guide through this entire thing, and the test works but I needed to delete all my existing containers. This should not be needed and the fixes proposed should cover this.
@ -0,0 +51,4 @@/*what services/images that need to be build vary between different services,once a image is made you must CreateAsync() before usign it in a ContainerBuilder */_postgres = new PostgreSqlBuilder("postgres:18.3-alpine3.23").WithImage("postgres:15-alpine")WithImage can be deleted, as it is not necessary.
@ -0,0 +56,4 @@.WithEnvironment("POSTGRES_PASSWORD", dbPassword).WithEnvironment("POSTGRES_DB", "sensors").WithEnvironment("POSTGRES_HOST_AUTH_METHOD", "trust").WithHostname("roombookingservice")The test container should not, and does not need a WithHostname or WithName. It just adds conflicts with existing containers.
Applies to line: 59, 60, 75 and 76
@ -0,0 +91,4 @@builder.ConfigureServices(services =>{/*currently services use diffrent DataSource names to connect to msqtt and similar thignsUsing this comment block as an example for others. Some things are still misspelled, abbreviations are small case, stuff like that.
While this is not in our code conventions, /* */ blocks structured like the example above makes them easier to read and easier to delete. As far as I know, this is commonly used in the industry.
I recommend going over all comments and applying the same method of the example above.
fixed as much as i can find, if there are still some misspellings please tell where(if you whant them to be fixed)
should else be acceptable enought as it is now.
@ -0,0 +166,4 @@{/*Test if http requests work by just checking if health returnsprefixes can be different for services.*/var response = await _httpClient.GetAsync("/roombooking/healthcheck");Wrong endpoint. Should be
Highlighted the spelling mistakes I could find.
Also, I highly recommend reading the C# coding conventions about comments. It talks about capitalization, spacing and ending comments with a period. This applies to all comments.
@ -0,0 +104,4 @@services.AddSingleton(testDataSource);/* We create a postgresql container, a place for databases exist but it seems to still need to be populated.* This helps create a real database and not a mock database so all tests ran on it would work on the actual database druing run time.Spelling, druing
@ -0,0 +177,4 @@[Fact]public async Task Get_bookingData_Returns_Success_And_Data(){/* http request after populating with the table. Again the database table is real, just empty so we create it durign cotnainer buildingSpelling, durign cotnainer
@ -0,0 +179,4 @@{/* http request after populating with the table. Again the database table is real, just empty so we create it durign cotnainer building* and in tests we can populate the table.* There should be some way to populate them as normal usign your generators but testcontainers are fast,usign as in unsigned or misspelling of using?
@ -0,0 +181,4 @@* and in tests we can populate the table.* There should be some way to populate them as normal usign your generators but testcontainers are fast,* once built they run the tests extremly quickly and then kill the contianers* so you propably don't even have time to passivly populate the containers.Spelling, passivly
Looks much better. Is ready to be merged