Skip to content

Commit

Permalink
feat: Add quarkus devfile to e2e tests and rename codecov.yml workflow (
Browse files Browse the repository at this point in the history
#1064)

* feat: Add devfile to e2e tests

Signed-off-by: Flavius Lacatusu <[email protected]>

* Fix

Signed-off-by: Flavius Lacatusu <[email protected]>

* fix

Signed-off-by: Flavius Lacatusu <[email protected]>
  • Loading branch information
flacatus authored Jan 15, 2021
1 parent 09c6233 commit dc032a1
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 13 deletions.
16 changes: 13 additions & 3 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
name: chectl
#
# Copyright (c) 2012-2021 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
# Contributors:
# Red Hat, Inc. - initial API and implementation

name: Code Coverage Report
on: [push]
jobs:
build-and-deploy:
code-coverage-report:
runs-on: ubuntu-20.04
name: Code coverage
steps:
- name: Checkout
uses: actions/[email protected]
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ chectl
[Eclipse Che](https://github.com/eclipse/che/) CLI

[![oclif](https://img.shields.io/badge/cli-oclif-brightgreen.svg)](https://oclif.io)
[![Codecov](https://img.shields.io/codecov/c/github/che-incubator/chectl)](https://github.com/che-incubator/chectl)
[![codecov](https://codecov.io/gh/che-incubator/chectl/branch/master/graph/badge.svg?token=ZBQtKMeiYu)](https://codecov.io/gh/che-incubator/chectl)
[![Build Status](https://travis-ci.org/che-incubator/chectl.svg?branch=master)](https://travis-ci.org/che-incubator/chectl)
![](https://img.shields.io/david/che-incubator/chectl.svg)

Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,9 @@
"types": "lib/index.d.ts",
"jest": {
"collectCoverage": true,
"coverageReporters": ["json"],
"coverageReporters": [
"json"
],
"collectCoverageFrom": [
"src/**/*.ts"
],
Expand Down
6 changes: 4 additions & 2 deletions test/e2e/e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ const INSTALLER_OPERATOR = 'operator'
const INSTALLER_HELM = 'helm'
const INSTALLER_OLM = 'olm'

const DEVFILE_URL = 'https://raw.githubusercontent.com/eclipse/che-devfile-registry/master/devfiles/quarkus/devfile.yaml'

function getDeployCommand(): string {
let command: string
switch (PLATFORM) {
Expand Down Expand Up @@ -148,7 +150,7 @@ describe('Workspace creation, list, start, inject, delete. Support stop and dele
it('Testing workspace:create command', async () => {
console.log('>>> Testing workspace:create command')

const { exitCode, stdout, stderr, } = await execa(binChectl, ['workspace:create', '--devfile=test/e2e/resources/devfile-example.yaml', '--telemetry=off', `-n ${NAMESPACE}`], { shell: true })
const { exitCode, stdout, stderr, } = await execa(binChectl, ['workspace:create', `--devfile=${DEVFILE_URL}`, '--telemetry=off', `-n ${NAMESPACE}`], { shell: true })
console.log(`stdout: ${stdout}`)
console.log(`stderr: ${stderr}`)
expect(exitCode).equal(0)
Expand All @@ -167,7 +169,7 @@ describe('Workspace creation, list, start, inject, delete. Support stop and dele
expect(exitCode).equal(0)

// Sleep time to wait to workspace to be running
await helper.sleep(200000)
await helper.sleep(300000)
const workspaceStatus = await helper.getWorkspaceStatus()
expect(workspaceStatus).to.contain('RUNNING')
})
Expand Down
3 changes: 0 additions & 3 deletions test/e2e/resources/devfile-example.yaml

This file was deleted.

7 changes: 4 additions & 3 deletions test/e2e/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ export class E2eHelper {
constructor() {
this.kubeHelper = new KubeHelper({})
this.che = new CheHelper({})
this.devfileName = 'e2e-tests'
// generate-name from https://raw.githubusercontent.com/eclipse/che-devfile-registry/master/devfiles/quarkus/devfile.yaml
this.devfileName = 'quarkus-'
this.oc = new OpenShiftHelper()
}

Expand All @@ -62,7 +63,7 @@ export class E2eHelper {
// Return id of test workspaces(e2e-tests. Please look devfile-example.yaml file)
async getWorkspaceId(): Promise<any> {
const workspaces = await this.getAllWorkspaces()
const workspaceId = workspaces.filter((wks => wks.name === this.devfileName)).map(({ id }) => id)[0]
const workspaceId = workspaces.filter((wks => wks.name.match(this.devfileName))).map(({ id }) => id)[0]

if (!workspaceId) {
throw Error('Error getting workspaceId')
Expand All @@ -74,7 +75,7 @@ export class E2eHelper {
// Return the status of test workspaces(e2e-tests. Please look devfile-example.yaml file)
async getWorkspaceStatus(): Promise<any> {
const workspaces = await this.getAllWorkspaces()
const workspaceStatus = workspaces.filter((wks => wks.name === this.devfileName)).map(({ status }) => status)[0]
const workspaceStatus = workspaces.filter((wks => wks.name.match(this.devfileName))).map(({ status }) => status)[0]

if (!workspaceStatus) {
throw Error('Error getting workspace_id')
Expand Down

0 comments on commit dc032a1

Please sign in to comment.