hosts.add(hostname, true);
});
- it('should delete a host and add it back', function () {
+ it('should drain and delete a host and then add it back', function () {
const host = Cypress._.last(this.hosts)['name'];
+
+ // should drain the host first before deleting
+ hosts.editLabels(host, ['_no_schedule'], true);
+ hosts.clickHostTab(host, 'Daemons');
+ cy.get('cd-host-details').within(() => {
+ // draining will take some time to complete.
+ // since we don't know how many daemons will be
+ // running in this host in future putting the wait
+ // to 15s
+ cy.wait(15000);
+ hosts.getTableCount('total').should('be.eq', 0);
+ });
hosts.delete(host);
// add it back