We have now “paused” the data we were previously using and have replaced it with the
data from the Test
data pod bookmark.
In this scene, we are going validate the presence of the bug, and work to source the root cause of the issue.
YOUR STEPS FOR THIS SCENE:
Part 1
- Open
Patients Dev
in a new tab. Login, and go to the Users section. You should now see we have replicated the “broken test” environment. - Notice the duplicate
mcred
username. This is the exact state of the bookmarked data in ourTest
data pod. - Let’s delete the duplicate
mcred
user. Click the X icon next to one of themcred
usernames - Click OK on the dialog box
- The application is now down to three users
- Let’s manually add a user to test the bug ourselves. Click the
+
icon to open theAdd User
form - Create a user with the username
mcred
. You can put any values you want into the other fields. Click Save - You should now see your user in the list. Once you verified the user, repeat steps 2 & 3 to delete the user.
Part 2 (Complete the steps for your data type)
- It is pretty obvious that the issue is we do not have a unique constraint on our username field.
Let’s patch this defect by applying a unique constraint to the username column of the USERS table in our database.
The following sql code should do it:
ALTER TABLE USERS ADD CONSTRAINT username UNIQUE(username);
- Let’s manually apply this to our Dev environent to see if it has the desired effect. Open a terminal window.
- SSH into the Development database server as the
centos
userssh centos@devdb
- Change to the
oracle
user.sudo su - oracle
- Connect to the
devdb
via sqlplussqlplus delphixdb/delphixdb@devdb:1521/devdb
- Copy and paste the sql code from step 10 into the terminal window and press enter.
You should see a message that says
Table altered
.
- It is pretty obvious that the issue is we do not have a unique constraint on our username field.
Let’s patch this defect by applying a unique constraint to the username column of the USERS table in our database.
The following sql code should do it:
ALTER TABLE ONLY public.users ADD CONSTRAINT username UNIQUE(username);
- Let’s manually apply this to our Dev environent to see if it has the desired effect. Open a terminal window.
- Connect to the
devdb
via psqlpsql -h devdb -p 5454 -U postgres dafdb
- Copy and paste the sql code from step 10 into the terminal window and press enter.
You should see a message that says
Table altered
.
Part 3
- Now let’s go to our Dev App and test the fix. Repeat steps 6 & 7 from Part 1, above.
- This time, you should notice that the application won’t allow us to add a duplicate user. In a real use case, we would update the application code to also return an error message, but that is beyond the scope of this workshop.
- Change the username to something unique and click save to validate that our add user form is still working.
- Great. Now let’s submit the patch.