Skip to content

Commit

Permalink
Adds API integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ogupte committed Mar 1, 2021
1 parent 7b1f0b4 commit c29bdfd
Showing 1 changed file with 21 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*/

import expect from '@kbn/expect';
import { countBy } from 'lodash';
import { registry } from '../../../common/registry';
import { FtrProviderContext } from '../../../common/ftr_provider_context';

Expand Down Expand Up @@ -49,7 +50,26 @@ export default function apiTest({ getService }: FtrProviderContext) {

const { body } = await getJobs();
expect(body.hasLegacyJobs).to.be(false);
expect(body.jobs.map((job: any) => job.environment)).to.eql(['production', 'staging']);
expect(countBy(body.jobs, 'environment')).to.eql({
production: 1,
staging: 1,
});
});

describe('with existing ML jobs', () => {
before(async () => {
await createJobs(['production', 'staging']);
});
it('skips duplicate job creation', async () => {
await createJobs(['production', 'test']);

const { body } = await getJobs();
expect(countBy(body.jobs, 'environment')).to.eql({
production: 1,
staging: 1,
test: 1,
});
});
});
});
});
Expand Down

0 comments on commit c29bdfd

Please sign in to comment.