Reset devtes01 and devtest02 dbs on each build

@michael, @cintiadr, could you please look into setting up https://ci.openmrs.org/browse/REFAPP-OMODDISTRO to reset database every build before running ui tests? You can use the same dump as for the demo server.

We need that for UI tests to be executed more reliably. Our tests misbehaved and broke those instances a few times last week. We need an automatic way to recover to a healthy state after fixing tests.

Sorry for the delay,

I will take a look this week. I’m still not sure how to setup the database or how much time it takes.

Is there a possibility of an to manually reset the database on devtest01 as an incomplete deletion of created patients in UI Tests causes existence of active visits of deleted patients that break visit and patient UI Tests.

Is this how it should be reset? https://ci.openmrs.org/build/admin/edit/editBuildTasks.action?buildKey=DEMO-DEMODB-JOB1

I can see it does a

/opt/scripts/dbreset/demo_db_reload.sh

But I’m not sure it’s in all servers.

What does the demo_db_reload.sh actually do?

I’m not particularly sure. I don’t think I do have access to the repository where they belong.

So the demo server apparently has a lot of scripts ( https://ci.openmrs.org/browse/RELEASE-RTMGIT-TE-43/log), I guess they got there using Ansible, puppet or anything, but I don’t know why devtest01 server doesn’t have it:

https://ci.openmrs.org/browse/RELEASE-RTMGIT-TE-44/log

@ryan, any chance you know about those database scripts?

Yes, they were written for the demo server so that is the only server that has them. I can deploy them to the same location on each of the devtest servers. I will also add the scripts to the ITSM repo.

1 Like

Any progress on that?

I have deployed the dbreset scripts out to /opt/scripts/dbreset on the devtest hosts. You will need to create a .my.cnf file with the appropriate data before running the demo_db_reload.sh script. You can use .my.cnf.example in the same dir as a template. Let me know if any other hosts need this and I will add them to the list.

Rafal,

Should we have any data on the servers before the tests run? Or do the tests create all the necessary data?

Hi, Cintia, Not all tests create the necessary data. Some tests regarding patients and visits expect that some data is already present.

@cintiadr, I would do a dump of the current database state on devtest01 and use it.