mirror of
https://github.com/redhat-developer/odo.git
synced 2025-10-19 03:06:19 +03:00
Remove devfile integration test dependency on git clone (#3065)
* add in node and spring projects for test Signed-off-by: Maysun J Faisal <maysun.j.faisal@ibm.com> * fix devfile integration tests for clone Signed-off-by: Maysun J Faisal <maysun.j.faisal@ibm.com> * remove .classpath .settings .project from test template Signed-off-by: Maysun J Faisal <maysun.j.faisal@ibm.com> * Update merged tests for devfile clone Signed-off-by: Maysun J Faisal <maysun.j.faisal@ibm.com> * Update merged url test and remove git clone Signed-off-by: Maysun J Faisal <maysun.j.faisal@ibm.com>
This commit is contained in:
7
.gitignore
vendored
7
.gitignore
vendored
@@ -75,3 +75,10 @@ tags
|
|||||||
|
|
||||||
# VSCode specific
|
# VSCode specific
|
||||||
.vscode
|
.vscode
|
||||||
|
|
||||||
|
#
|
||||||
|
# MAC OS SPECIFIC
|
||||||
|
#
|
||||||
|
|
||||||
|
# Finder Desktop Service
|
||||||
|
.DS_Store
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ jobs:
|
|||||||
|
|
||||||
- <<: *base-test
|
- <<: *base-test
|
||||||
stage: test
|
stage: test
|
||||||
name: "docker devfile push and delete command integration tests"
|
name: "docker devfile push, url, catalog, delete command integration tests"
|
||||||
script:
|
script:
|
||||||
- make bin
|
- make bin
|
||||||
- sudo cp odo /usr/bin
|
- sudo cp odo /usr/bin
|
||||||
|
|||||||
24
tests/examples/source/devfiles/nodejs/project/app/app.js
Normal file
24
tests/examples/source/devfiles/nodejs/project/app/app.js
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2012-2019 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*eslint-env node*/
|
||||||
|
|
||||||
|
var express = require('express');
|
||||||
|
var app = express();
|
||||||
|
|
||||||
|
app.get('/', function (req, res) {
|
||||||
|
res.send('Hello World!');
|
||||||
|
});
|
||||||
|
|
||||||
|
app.listen(3000, function () {
|
||||||
|
console.log('Example app listening on port 3000!');
|
||||||
|
});
|
||||||
14
tests/examples/source/devfiles/nodejs/project/package.json
Normal file
14
tests/examples/source/devfiles/nodejs/project/package.json
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"name": "nodejs-sample",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "",
|
||||||
|
"main": "app/app.js",
|
||||||
|
"scripts": {
|
||||||
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
|
},
|
||||||
|
"author": "",
|
||||||
|
"license": "EPL-2.0",
|
||||||
|
"dependencies": {
|
||||||
|
"express": "^4.13.4"
|
||||||
|
}
|
||||||
|
}
|
||||||
4
tests/examples/source/devfiles/springboot/project/.gitignore
vendored
Normal file
4
tests/examples/source/devfiles/springboot/project/.gitignore
vendored
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
target/
|
||||||
|
.classpath
|
||||||
|
.project
|
||||||
|
.settings/
|
||||||
84
tests/examples/source/devfiles/springboot/project/pom.xml
Normal file
84
tests/examples/source/devfiles/springboot/project/pom.xml
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<groupId>projects</groupId>
|
||||||
|
<artifactId>sprtest1</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||||
|
<maven.compiler.source>1.8</maven.compiler.source>
|
||||||
|
<maven.compiler.target>1.8</maven.compiler.target>
|
||||||
|
<java.version>1.8</java.version>
|
||||||
|
<spring-cloud.version>Dalston.SR4</spring-cloud.version>
|
||||||
|
|
||||||
|
<app.name>sprtest1</app.name>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<parent>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
|
<version>1.5.15.RELEASE</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-actuator</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-hystrix</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<!-- Configure javametrics monitoring -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.ibm.runtimetools</groupId>
|
||||||
|
<artifactId>javametrics-spring</artifactId>
|
||||||
|
<version>[1.1,2.0)</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.ibm.runtimetools</groupId>
|
||||||
|
<artifactId>javametrics-agent</artifactId>
|
||||||
|
<version>[1.1,2.0)</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.glassfish</groupId>
|
||||||
|
<artifactId>javax.json</artifactId>
|
||||||
|
<version>1.0.4</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<dependencyManagement>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-dependencies</artifactId>
|
||||||
|
<version>${spring-cloud.version}</version>
|
||||||
|
<type>pom</type>
|
||||||
|
<scope>import</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</dependencyManagement>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
</project>
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package application;
|
||||||
|
|
||||||
|
import org.springframework.context.event.EventListener;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.boot.context.event.ApplicationReadyEvent;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class Info {
|
||||||
|
|
||||||
|
@EventListener(ApplicationReadyEvent.class)
|
||||||
|
public void contextRefreshedEvent() {
|
||||||
|
System.out.println("The following endpoints are available by default :-");
|
||||||
|
System.out.println(" Health : http://localhost:8080/health");
|
||||||
|
System.out.println(" Application : http://localhost:8080/v1/");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package application;
|
||||||
|
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.context.annotation.ComponentScan;
|
||||||
|
|
||||||
|
@SpringBootApplication
|
||||||
|
@ComponentScan(basePackages = {"application", "com.ibm.javametrics.spring"})
|
||||||
|
public class SBApplication {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(SBApplication.class, args);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package application.rest.v1;
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
public class Example {
|
||||||
|
|
||||||
|
|
||||||
|
@RequestMapping("v1")
|
||||||
|
public @ResponseBody ResponseEntity<String> example() {
|
||||||
|
List<String> list = new ArrayList<>();
|
||||||
|
//return a simple list of strings
|
||||||
|
list.add("Congratulations, your application is up and running.");
|
||||||
|
return new ResponseEntity<String>(list.toString(), HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
4
tests/examples/source/openjdk-sb-postgresql/.gitignore
vendored
Normal file
4
tests/examples/source/openjdk-sb-postgresql/.gitignore
vendored
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
target/
|
||||||
|
.classpath
|
||||||
|
.project
|
||||||
|
.settings/
|
||||||
4
tests/examples/source/openjdk/.gitignore
vendored
Normal file
4
tests/examples/source/openjdk/.gitignore
vendored
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
target/
|
||||||
|
.classpath
|
||||||
|
.project
|
||||||
|
.settings/
|
||||||
4
tests/examples/source/wildfly/.gitignore
vendored
Normal file
4
tests/examples/source/wildfly/.gitignore
vendored
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
target/
|
||||||
|
.classpath
|
||||||
|
.project
|
||||||
|
.settings/
|
||||||
@@ -12,8 +12,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var _ = Describe("odo devfile delete command tests", func() {
|
var _ = Describe("odo devfile delete command tests", func() {
|
||||||
var namespace, context, currentWorkingDirectory, componentName, projectDirPath string
|
var namespace, context, currentWorkingDirectory, componentName string
|
||||||
var projectDir = "/projectDir"
|
|
||||||
|
|
||||||
// TODO: all oc commands in all devfile related test should get replaced by kubectl
|
// TODO: all oc commands in all devfile related test should get replaced by kubectl
|
||||||
// TODO: to goal is not to use "oc"
|
// TODO: to goal is not to use "oc"
|
||||||
@@ -25,7 +24,6 @@ var _ = Describe("odo devfile delete command tests", func() {
|
|||||||
namespace = helper.CreateRandProject()
|
namespace = helper.CreateRandProject()
|
||||||
context = helper.CreateNewContext()
|
context = helper.CreateNewContext()
|
||||||
currentWorkingDirectory = helper.Getwd()
|
currentWorkingDirectory = helper.Getwd()
|
||||||
projectDirPath = context + projectDir
|
|
||||||
componentName = helper.RandString(6)
|
componentName = helper.RandString(6)
|
||||||
|
|
||||||
helper.Chdir(context)
|
helper.Chdir(context)
|
||||||
@@ -48,12 +46,10 @@ var _ = Describe("odo devfile delete command tests", func() {
|
|||||||
Context("when devfile delete command is executed", func() {
|
Context("when devfile delete command is executed", func() {
|
||||||
|
|
||||||
It("should delete the component created from the devfile and also the owned resources", func() {
|
It("should delete the component created from the devfile and also the owned resources", func() {
|
||||||
helper.CmdShouldPass("git", "clone", "https://github.com/che-samples/web-nodejs-sample.git", projectDirPath)
|
|
||||||
helper.Chdir(projectDirPath)
|
|
||||||
|
|
||||||
helper.CmdShouldPass("odo", "create", "nodejs", "--project", namespace, componentName)
|
helper.CmdShouldPass("odo", "create", "nodejs", "--project", namespace, componentName)
|
||||||
|
|
||||||
helper.CopyExample(filepath.Join("source", "devfiles", "nodejs"), projectDirPath)
|
helper.CopyExample(filepath.Join("source", "devfiles", "nodejs", "project"), context)
|
||||||
|
helper.CopyExampleDevFile(filepath.Join("source", "devfiles", "nodejs", "devfile.yaml"), filepath.Join(context, "devfile.yaml"))
|
||||||
|
|
||||||
helper.CmdShouldPass("odo", "url", "create", "example", "--host", "1.2.3.4.nip.io")
|
helper.CmdShouldPass("odo", "url", "create", "example", "--host", "1.2.3.4.nip.io")
|
||||||
|
|
||||||
@@ -71,22 +67,20 @@ var _ = Describe("odo devfile delete command tests", func() {
|
|||||||
Context("when devfile delete command is executed with all flag", func() {
|
Context("when devfile delete command is executed with all flag", func() {
|
||||||
|
|
||||||
It("should delete the component created from the devfile and also the env and odo folders and the odo-index-file.json file", func() {
|
It("should delete the component created from the devfile and also the env and odo folders and the odo-index-file.json file", func() {
|
||||||
helper.CmdShouldPass("git", "clone", "https://github.com/che-samples/web-nodejs-sample.git", projectDirPath)
|
|
||||||
helper.Chdir(projectDirPath)
|
|
||||||
|
|
||||||
helper.CmdShouldPass("odo", "create", "nodejs", "--project", namespace, componentName)
|
helper.CmdShouldPass("odo", "create", "nodejs", "--project", namespace, componentName)
|
||||||
|
|
||||||
helper.CopyExample(filepath.Join("source", "devfiles", "nodejs"), projectDirPath)
|
helper.CopyExample(filepath.Join("source", "devfiles", "nodejs", "project"), context)
|
||||||
|
helper.CopyExampleDevFile(filepath.Join("source", "devfiles", "nodejs", "devfile.yaml"), filepath.Join(context, "devfile.yaml"))
|
||||||
|
|
||||||
helper.CmdShouldPass("odo", "push", "--devfile", "devfile.yaml", "--project", namespace)
|
helper.CmdShouldPass("odo", "push", "--devfile", "devfile.yaml", "--project", namespace)
|
||||||
|
|
||||||
helper.CmdShouldPass("odo", "url", "create", "example", "--host", "1.2.3.4.nip.io", "--context", projectDirPath)
|
helper.CmdShouldPass("odo", "url", "create", "example", "--host", "1.2.3.4.nip.io", "--context", context)
|
||||||
|
|
||||||
helper.CmdShouldPass("odo", "delete", "--devfile", "devfile.yaml", "--project", namespace, "-f", "--all")
|
helper.CmdShouldPass("odo", "delete", "--devfile", "devfile.yaml", "--project", namespace, "-f", "--all")
|
||||||
|
|
||||||
oc.WaitAndCheckForExistence("deployments", namespace, 1)
|
oc.WaitAndCheckForExistence("deployments", namespace, 1)
|
||||||
|
|
||||||
files := helper.ListFilesInDir(projectDirPath)
|
files := helper.ListFilesInDir(context)
|
||||||
Expect(files).To(Not(ContainElement(".odo")))
|
Expect(files).To(Not(ContainElement(".odo")))
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -14,8 +14,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var _ = Describe("odo devfile push command tests", func() {
|
var _ = Describe("odo devfile push command tests", func() {
|
||||||
var namespace, context, cmpName, currentWorkingDirectory, projectDirPath string
|
var namespace, context, cmpName, currentWorkingDirectory string
|
||||||
var projectDir = "/projectDir"
|
|
||||||
var sourcePath = "/projects/nodejs-web-app"
|
var sourcePath = "/projects/nodejs-web-app"
|
||||||
|
|
||||||
// TODO: all oc commands in all devfile related test should get replaced by kubectl
|
// TODO: all oc commands in all devfile related test should get replaced by kubectl
|
||||||
@@ -28,7 +27,6 @@ var _ = Describe("odo devfile push command tests", func() {
|
|||||||
namespace = helper.CreateRandProject()
|
namespace = helper.CreateRandProject()
|
||||||
context = helper.CreateNewContext()
|
context = helper.CreateNewContext()
|
||||||
currentWorkingDirectory = helper.Getwd()
|
currentWorkingDirectory = helper.Getwd()
|
||||||
projectDirPath = context + projectDir
|
|
||||||
cmpName = helper.RandString(6)
|
cmpName = helper.RandString(6)
|
||||||
|
|
||||||
helper.Chdir(context)
|
helper.Chdir(context)
|
||||||
@@ -51,15 +49,12 @@ var _ = Describe("odo devfile push command tests", func() {
|
|||||||
Context("Verify devfile push works", func() {
|
Context("Verify devfile push works", func() {
|
||||||
|
|
||||||
It("should have no errors when no endpoints within the devfile, should create a service when devfile has endpoints", func() {
|
It("should have no errors when no endpoints within the devfile, should create a service when devfile has endpoints", func() {
|
||||||
helper.CmdShouldPass("git", "clone", "https://github.com/che-samples/web-nodejs-sample.git", projectDirPath)
|
|
||||||
helper.Chdir(projectDirPath)
|
|
||||||
|
|
||||||
helper.CmdShouldPass("odo", "create", "nodejs", "--project", namespace, cmpName)
|
helper.CmdShouldPass("odo", "create", "nodejs", "--project", namespace, cmpName)
|
||||||
|
|
||||||
helper.CopyExample(filepath.Join("source", "devfiles", "nodejs"), projectDirPath)
|
helper.CopyExample(filepath.Join("source", "devfiles", "nodejs", "project"), context)
|
||||||
|
|
||||||
helper.RenameFile("devfile.yaml", "devfile-old.yaml")
|
helper.RenameFile("devfile.yaml", "devfile-old.yaml")
|
||||||
helper.RenameFile("devfile-no-endpoints.yaml", "devfile.yaml")
|
helper.CopyExampleDevFile(filepath.Join("source", "devfiles", "nodejs", "devfile-no-endpoints.yaml"), filepath.Join(context, "devfile.yaml"))
|
||||||
|
|
||||||
helper.CmdShouldPass("odo", "push", "--devfile", "devfile.yaml", "--project", namespace)
|
helper.CmdShouldPass("odo", "push", "--devfile", "devfile.yaml", "--project", namespace)
|
||||||
output := oc.GetServices(namespace)
|
output := oc.GetServices(namespace)
|
||||||
Expect(output).NotTo(ContainSubstring(cmpName))
|
Expect(output).NotTo(ContainSubstring(cmpName))
|
||||||
@@ -73,12 +68,10 @@ var _ = Describe("odo devfile push command tests", func() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
It("checks that odo push works with a devfile", func() {
|
It("checks that odo push works with a devfile", func() {
|
||||||
helper.CmdShouldPass("git", "clone", "https://github.com/che-samples/web-nodejs-sample.git", projectDirPath)
|
|
||||||
helper.Chdir(projectDirPath)
|
|
||||||
|
|
||||||
helper.CmdShouldPass("odo", "create", "nodejs", "--project", namespace, cmpName)
|
helper.CmdShouldPass("odo", "create", "nodejs", "--project", namespace, cmpName)
|
||||||
|
|
||||||
helper.CopyExample(filepath.Join("source", "devfiles", "nodejs"), projectDirPath)
|
helper.CopyExample(filepath.Join("source", "devfiles", "nodejs", "project"), context)
|
||||||
|
helper.CopyExampleDevFile(filepath.Join("source", "devfiles", "nodejs", "devfile.yaml"), filepath.Join(context, "devfile.yaml"))
|
||||||
|
|
||||||
output := helper.CmdShouldPass("odo", "push", "--devfile", "devfile.yaml", "--project", namespace)
|
output := helper.CmdShouldPass("odo", "push", "--devfile", "devfile.yaml", "--project", namespace)
|
||||||
Expect(output).To(ContainSubstring("Changes successfully pushed to component"))
|
Expect(output).To(ContainSubstring("Changes successfully pushed to component"))
|
||||||
@@ -89,28 +82,25 @@ var _ = Describe("odo devfile push command tests", func() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
It("checks that odo push works outside of the context directory", func() {
|
It("checks that odo push works outside of the context directory", func() {
|
||||||
helper.CmdShouldPass("git", "clone", "https://github.com/che-samples/web-nodejs-sample.git", projectDirPath)
|
helper.Chdir(currentWorkingDirectory)
|
||||||
|
|
||||||
helper.CmdShouldPass("odo", "create", "nodejs", "--project", namespace, "--context", projectDirPath, cmpName)
|
helper.CmdShouldPass("odo", "create", "nodejs", "--project", namespace, "--context", context, cmpName)
|
||||||
|
|
||||||
helper.CopyExample(filepath.Join("source", "devfiles", "nodejs"), projectDirPath)
|
helper.CopyExample(filepath.Join("source", "devfiles", "nodejs", "project"), context)
|
||||||
|
helper.CopyExampleDevFile(filepath.Join("source", "devfiles", "nodejs", "devfile.yaml"), filepath.Join(context, "devfile.yaml"))
|
||||||
|
|
||||||
output := helper.CmdShouldPass("odo", "push", "--devfile", "devfile.yaml", "--context", projectDirPath)
|
output := helper.CmdShouldPass("odo", "push", "--devfile", "devfile.yaml", "--context", context)
|
||||||
Expect(output).To(ContainSubstring("Changes successfully pushed to component"))
|
Expect(output).To(ContainSubstring("Changes successfully pushed to component"))
|
||||||
})
|
})
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
Context("When devfile push command is executed", func() {
|
|
||||||
|
|
||||||
It("should not build when no changes are detected in the directory and build when a file change is detected", func() {
|
It("should not build when no changes are detected in the directory and build when a file change is detected", func() {
|
||||||
utils.ExecPushToTestFileChanges(projectDirPath, cmpName, namespace)
|
utils.ExecPushToTestFileChanges(context, cmpName, namespace)
|
||||||
})
|
})
|
||||||
|
|
||||||
It("should be able to create a file, push, delete, then push again propagating the deletions", func() {
|
It("should be able to create a file, push, delete, then push again propagating the deletions", func() {
|
||||||
newFilePath := filepath.Join(projectDirPath, "foobar.txt")
|
newFilePath := filepath.Join(context, "foobar.txt")
|
||||||
newDirPath := filepath.Join(projectDirPath, "testdir")
|
newDirPath := filepath.Join(context, "testdir")
|
||||||
utils.ExecPushWithNewFileAndDir(projectDirPath, cmpName, namespace, newFilePath, newDirPath)
|
utils.ExecPushWithNewFileAndDir(context, cmpName, namespace, newFilePath, newDirPath)
|
||||||
|
|
||||||
// Check to see if it's been pushed (foobar.txt abd directory testdir)
|
// Check to see if it's been pushed (foobar.txt abd directory testdir)
|
||||||
podName := oc.GetRunningPodNameByComponent(cmpName, namespace)
|
podName := oc.GetRunningPodNameByComponent(cmpName, namespace)
|
||||||
@@ -131,12 +121,10 @@ var _ = Describe("odo devfile push command tests", func() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
It("should delete the files from the container if its removed locally", func() {
|
It("should delete the files from the container if its removed locally", func() {
|
||||||
helper.CmdShouldPass("git", "clone", "https://github.com/che-samples/web-nodejs-sample.git", projectDirPath)
|
|
||||||
helper.Chdir(projectDirPath)
|
|
||||||
|
|
||||||
helper.CmdShouldPass("odo", "create", "nodejs", "--project", namespace, cmpName)
|
helper.CmdShouldPass("odo", "create", "nodejs", "--project", namespace, cmpName)
|
||||||
|
|
||||||
helper.CopyExample(filepath.Join("source", "devfiles", "nodejs"), projectDirPath)
|
helper.CopyExample(filepath.Join("source", "devfiles", "nodejs", "project"), context)
|
||||||
|
helper.CopyExampleDevFile(filepath.Join("source", "devfiles", "nodejs", "devfile.yaml"), filepath.Join(context, "devfile.yaml"))
|
||||||
|
|
||||||
helper.CmdShouldPass("odo", "push", "--devfile", "devfile.yaml", "--project", namespace)
|
helper.CmdShouldPass("odo", "push", "--devfile", "devfile.yaml", "--project", namespace)
|
||||||
|
|
||||||
@@ -155,7 +143,7 @@ var _ = Describe("odo devfile push command tests", func() {
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
Expect(statErr).ToNot(HaveOccurred())
|
Expect(statErr).ToNot(HaveOccurred())
|
||||||
Expect(os.Remove(filepath.Join(projectDirPath, "app", "app.js"))).NotTo(HaveOccurred())
|
Expect(os.Remove(filepath.Join(context, "app", "app.js"))).NotTo(HaveOccurred())
|
||||||
helper.CmdShouldPass("odo", "push", "--devfile", "devfile.yaml", "--project", namespace)
|
helper.CmdShouldPass("odo", "push", "--devfile", "devfile.yaml", "--project", namespace)
|
||||||
|
|
||||||
oc.CheckCmdOpInRemoteDevfilePod(
|
oc.CheckCmdOpInRemoteDevfilePod(
|
||||||
@@ -173,11 +161,11 @@ var _ = Describe("odo devfile push command tests", func() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
It("should build when no changes are detected in the directory and force flag is enabled", func() {
|
It("should build when no changes are detected in the directory and force flag is enabled", func() {
|
||||||
utils.ExecPushWithForceFlag(projectDirPath, cmpName, namespace)
|
utils.ExecPushWithForceFlag(context, cmpName, namespace)
|
||||||
})
|
})
|
||||||
|
|
||||||
It("should execute the default devbuild and devrun commands if present", func() {
|
It("should execute the default devbuild and devrun commands if present", func() {
|
||||||
utils.ExecDefaultDevfileCommands(projectDirPath, cmpName, namespace)
|
utils.ExecDefaultDevfileCommands(context, cmpName, namespace)
|
||||||
|
|
||||||
// Check to see if it's been pushed (foobar.txt abd directory testdir)
|
// Check to see if it's been pushed (foobar.txt abd directory testdir)
|
||||||
podName := oc.GetRunningPodNameByComponent(cmpName, namespace)
|
podName := oc.GetRunningPodNameByComponent(cmpName, namespace)
|
||||||
@@ -200,61 +188,51 @@ var _ = Describe("odo devfile push command tests", func() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
It("should execute devinit command if present", func() {
|
It("should execute devinit command if present", func() {
|
||||||
helper.CmdShouldPass("git", "clone", "https://github.com/maysunfaisal/springboot.git", projectDirPath)
|
|
||||||
helper.Chdir(projectDirPath)
|
|
||||||
|
|
||||||
helper.CmdShouldPass("odo", "create", "java-spring-boot", "--project", namespace, cmpName)
|
helper.CmdShouldPass("odo", "create", "java-spring-boot", "--project", namespace, cmpName)
|
||||||
|
|
||||||
helper.CopyExample(filepath.Join("source", "devfiles", "springboot"), projectDirPath)
|
helper.CopyExample(filepath.Join("source", "devfiles", "springboot", "project"), context)
|
||||||
|
helper.CopyExampleDevFile(filepath.Join("source", "devfiles", "springboot", "devfile-init.yaml"), filepath.Join(context, "devfile.yaml"))
|
||||||
|
|
||||||
output := helper.CmdShouldPass("odo", "push", "--devfile", "devfile-init.yaml", "--namespace", namespace)
|
output := helper.CmdShouldPass("odo", "push", "--devfile", "devfile.yaml", "--namespace", namespace)
|
||||||
Expect(output).To(ContainSubstring("Executing devinit command \"echo hello"))
|
Expect(output).To(ContainSubstring("Executing devinit command \"echo hello"))
|
||||||
Expect(output).To(ContainSubstring("Executing devbuild command \"/artifacts/bin/build-container-full.sh\""))
|
Expect(output).To(ContainSubstring("Executing devbuild command \"/artifacts/bin/build-container-full.sh\""))
|
||||||
Expect(output).To(ContainSubstring("Executing devrun command \"/artifacts/bin/start-server.sh\""))
|
Expect(output).To(ContainSubstring("Executing devrun command \"/artifacts/bin/start-server.sh\""))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("should execute devinit and devrun commands if present", func() {
|
It("should execute devinit and devrun commands if present", func() {
|
||||||
helper.CmdShouldPass("git", "clone", "https://github.com/maysunfaisal/springboot.git", projectDirPath)
|
|
||||||
helper.Chdir(projectDirPath)
|
|
||||||
|
|
||||||
helper.CmdShouldPass("odo", "create", "java-spring-boot", "--project", namespace, cmpName)
|
helper.CmdShouldPass("odo", "create", "java-spring-boot", "--project", namespace, cmpName)
|
||||||
|
|
||||||
helper.CopyExample(filepath.Join("source", "devfiles", "springboot"), projectDirPath)
|
helper.CopyExample(filepath.Join("source", "devfiles", "springboot", "project"), context)
|
||||||
|
helper.CopyExampleDevFile(filepath.Join("source", "devfiles", "springboot", "devfile-init-without-build.yaml"), filepath.Join(context, "devfile.yaml"))
|
||||||
|
|
||||||
output := helper.CmdShouldPass("odo", "push", "--devfile", "devfile-init-without-build.yaml", "--namespace", namespace)
|
output := helper.CmdShouldPass("odo", "push", "--devfile", "devfile.yaml", "--namespace", namespace)
|
||||||
Expect(output).To(ContainSubstring("Executing devinit command \"echo hello"))
|
Expect(output).To(ContainSubstring("Executing devinit command \"echo hello"))
|
||||||
Expect(output).To(ContainSubstring("Executing devrun command \"/artifacts/bin/start-server.sh\""))
|
Expect(output).To(ContainSubstring("Executing devrun command \"/artifacts/bin/start-server.sh\""))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("should only execute devinit command once if component is already created", func() {
|
It("should only execute devinit command once if component is already created", func() {
|
||||||
helper.CmdShouldPass("git", "clone", "https://github.com/maysunfaisal/springboot.git", projectDirPath)
|
|
||||||
helper.Chdir(projectDirPath)
|
|
||||||
|
|
||||||
helper.CmdShouldPass("odo", "create", "java-spring-boot", "--project", namespace, cmpName)
|
helper.CmdShouldPass("odo", "create", "java-spring-boot", "--project", namespace, cmpName)
|
||||||
|
|
||||||
helper.CopyExample(filepath.Join("source", "devfiles", "springboot"), projectDirPath)
|
helper.CopyExample(filepath.Join("source", "devfiles", "springboot", "project"), context)
|
||||||
|
helper.CopyExampleDevFile(filepath.Join("source", "devfiles", "springboot", "devfile-init.yaml"), filepath.Join(context, "devfile.yaml"))
|
||||||
|
|
||||||
output := helper.CmdShouldPass("odo", "push", "--devfile", "devfile-init.yaml", "--namespace", namespace)
|
output := helper.CmdShouldPass("odo", "push", "--devfile", "devfile.yaml", "--namespace", namespace)
|
||||||
Expect(output).To(ContainSubstring("Executing devinit command \"echo hello"))
|
Expect(output).To(ContainSubstring("Executing devinit command \"echo hello"))
|
||||||
Expect(output).To(ContainSubstring("Executing devbuild command \"/artifacts/bin/build-container-full.sh\""))
|
Expect(output).To(ContainSubstring("Executing devbuild command \"/artifacts/bin/build-container-full.sh\""))
|
||||||
Expect(output).To(ContainSubstring("Executing devrun command \"/artifacts/bin/start-server.sh\""))
|
Expect(output).To(ContainSubstring("Executing devrun command \"/artifacts/bin/start-server.sh\""))
|
||||||
|
|
||||||
// Need to force so build and run get triggered again with the component already created.
|
// Need to force so build and run get triggered again with the component already created.
|
||||||
output = helper.CmdShouldPass("odo", "push", "--devfile", "devfile-init.yaml", "--namespace", namespace, "-f")
|
output = helper.CmdShouldPass("odo", "push", "--devfile", "devfile.yaml", "--namespace", namespace, "-f")
|
||||||
Expect(output).NotTo(ContainSubstring("Executing devinit command \"echo hello"))
|
Expect(output).NotTo(ContainSubstring("Executing devinit command \"echo hello"))
|
||||||
Expect(output).To(ContainSubstring("Executing devbuild command \"/artifacts/bin/build-container-full.sh\""))
|
Expect(output).To(ContainSubstring("Executing devbuild command \"/artifacts/bin/build-container-full.sh\""))
|
||||||
Expect(output).To(ContainSubstring("Executing devrun command \"/artifacts/bin/start-server.sh\""))
|
Expect(output).To(ContainSubstring("Executing devrun command \"/artifacts/bin/start-server.sh\""))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("should be able to handle a missing devinit command", func() {
|
It("should be able to handle a missing devinit command", func() {
|
||||||
helper.CmdShouldPass("git", "clone", "https://github.com/che-samples/web-nodejs-sample.git", projectDirPath)
|
|
||||||
helper.Chdir(projectDirPath)
|
|
||||||
|
|
||||||
helper.CmdShouldPass("odo", "create", "nodejs", "--project", namespace, cmpName)
|
helper.CmdShouldPass("odo", "create", "nodejs", "--project", namespace, cmpName)
|
||||||
|
|
||||||
helper.CopyExample(filepath.Join("source", "devfiles", "nodejs"), projectDirPath)
|
helper.CopyExample(filepath.Join("source", "devfiles", "nodejs", "project"), context)
|
||||||
helper.RenameFile("devfile.yaml", "devfile-old.yaml")
|
helper.CopyExampleDevFile(filepath.Join("source", "devfiles", "nodejs", "devfile-without-devinit.yaml"), filepath.Join(context, "devfile.yaml"))
|
||||||
helper.RenameFile("devfile-without-devinit.yaml", "devfile.yaml")
|
|
||||||
|
|
||||||
output := helper.CmdShouldPass("odo", "push", "--devfile", "devfile.yaml", "--namespace", namespace)
|
output := helper.CmdShouldPass("odo", "push", "--devfile", "devfile.yaml", "--namespace", namespace)
|
||||||
Expect(output).NotTo(ContainSubstring("Executing devinit command"))
|
Expect(output).NotTo(ContainSubstring("Executing devinit command"))
|
||||||
@@ -263,34 +241,30 @@ var _ = Describe("odo devfile push command tests", func() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
It("should be able to handle a missing devbuild command", func() {
|
It("should be able to handle a missing devbuild command", func() {
|
||||||
utils.ExecWithMissingBuildCommand(projectDirPath, cmpName, namespace)
|
utils.ExecWithMissingBuildCommand(context, cmpName, namespace)
|
||||||
})
|
})
|
||||||
|
|
||||||
It("should error out on a missing devrun command", func() {
|
It("should error out on a missing devrun command", func() {
|
||||||
utils.ExecWithMissingRunCommand(projectDirPath, cmpName, namespace)
|
utils.ExecWithMissingRunCommand(context, cmpName, namespace)
|
||||||
})
|
})
|
||||||
|
|
||||||
It("should be able to push using the custom commands", func() {
|
It("should be able to push using the custom commands", func() {
|
||||||
utils.ExecWithCustomCommand(projectDirPath, cmpName, namespace)
|
utils.ExecWithCustomCommand(context, cmpName, namespace)
|
||||||
})
|
})
|
||||||
|
|
||||||
It("should error out on a wrong custom commands", func() {
|
It("should error out on a wrong custom commands", func() {
|
||||||
utils.ExecWithWrongCustomCommand(projectDirPath, cmpName, namespace)
|
utils.ExecWithWrongCustomCommand(context, cmpName, namespace)
|
||||||
})
|
})
|
||||||
|
|
||||||
It("should not restart the application if restart is false", func() {
|
It("should not restart the application if restart is false", func() {
|
||||||
utils.ExecWithRestartAttribute(projectDirPath, cmpName, namespace)
|
utils.ExecWithRestartAttribute(context, cmpName, namespace)
|
||||||
})
|
})
|
||||||
|
|
||||||
It("should create pvc and reuse if it shares the same devfile volume name", func() {
|
It("should create pvc and reuse if it shares the same devfile volume name", func() {
|
||||||
helper.CmdShouldPass("git", "clone", "https://github.com/che-samples/web-nodejs-sample.git", projectDirPath)
|
|
||||||
helper.Chdir(projectDirPath)
|
|
||||||
|
|
||||||
helper.CmdShouldPass("odo", "create", "nodejs", "--project", namespace, cmpName)
|
helper.CmdShouldPass("odo", "create", "nodejs", "--project", namespace, cmpName)
|
||||||
|
|
||||||
helper.CopyExample(filepath.Join("source", "devfiles", "nodejs"), projectDirPath)
|
helper.CopyExample(filepath.Join("source", "devfiles", "nodejs", "project"), context)
|
||||||
helper.RenameFile("devfile.yaml", "devfile-old.yaml")
|
helper.CopyExampleDevFile(filepath.Join("source", "devfiles", "nodejs", "devfile-with-volumes.yaml"), filepath.Join(context, "devfile.yaml"))
|
||||||
helper.RenameFile("devfile-with-volumes.yaml", "devfile.yaml")
|
|
||||||
|
|
||||||
output := helper.CmdShouldPass("odo", "push", "--devfile", "devfile.yaml", "--namespace", namespace)
|
output := helper.CmdShouldPass("odo", "push", "--devfile", "devfile.yaml", "--namespace", namespace)
|
||||||
Expect(output).To(ContainSubstring("Executing devinit command"))
|
Expect(output).To(ContainSubstring("Executing devinit command"))
|
||||||
|
|||||||
@@ -14,8 +14,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var _ = Describe("odo devfile url command tests", func() {
|
var _ = Describe("odo devfile url command tests", func() {
|
||||||
var namespace, context, componentName, currentWorkingDirectory, projectDirPath string
|
var namespace, context, componentName, currentWorkingDirectory string
|
||||||
var projectDir = "/projectDir"
|
|
||||||
|
|
||||||
// This is run after every Spec (It)
|
// This is run after every Spec (It)
|
||||||
var _ = BeforeEach(func() {
|
var _ = BeforeEach(func() {
|
||||||
@@ -24,7 +23,6 @@ var _ = Describe("odo devfile url command tests", func() {
|
|||||||
namespace = helper.CreateRandProject()
|
namespace = helper.CreateRandProject()
|
||||||
context = helper.CreateNewContext()
|
context = helper.CreateNewContext()
|
||||||
currentWorkingDirectory = helper.Getwd()
|
currentWorkingDirectory = helper.Getwd()
|
||||||
projectDirPath = context + projectDir
|
|
||||||
componentName = helper.RandString(6)
|
componentName = helper.RandString(6)
|
||||||
|
|
||||||
helper.Chdir(context)
|
helper.Chdir(context)
|
||||||
@@ -50,12 +48,10 @@ var _ = Describe("odo devfile url command tests", func() {
|
|||||||
url1 := helper.RandString(5)
|
url1 := helper.RandString(5)
|
||||||
host := helper.RandString(5) + ".com"
|
host := helper.RandString(5) + ".com"
|
||||||
|
|
||||||
helper.CmdShouldPass("git", "clone", "https://github.com/che-samples/web-nodejs-sample.git", projectDirPath)
|
|
||||||
helper.Chdir(projectDirPath)
|
|
||||||
|
|
||||||
helper.CmdShouldPass("odo", "create", "nodejs", "--project", namespace, componentName)
|
helper.CmdShouldPass("odo", "create", "nodejs", "--project", namespace, componentName)
|
||||||
|
|
||||||
helper.CopyExample(filepath.Join("source", "devfiles", "nodejs"), projectDirPath)
|
helper.CopyExample(filepath.Join("source", "devfiles", "nodejs", "project"), context)
|
||||||
|
helper.CopyExampleDevFile(filepath.Join("source", "devfiles", "nodejs", "devfile.yaml"), filepath.Join(context, "devfile.yaml"))
|
||||||
|
|
||||||
stdout = helper.CmdShouldFail("odo", "url", "list")
|
stdout = helper.CmdShouldFail("odo", "url", "list")
|
||||||
Expect(stdout).To(ContainSubstring("no URLs found"))
|
Expect(stdout).To(ContainSubstring("no URLs found"))
|
||||||
@@ -86,12 +82,10 @@ var _ = Describe("odo devfile url command tests", func() {
|
|||||||
url1 := helper.RandString(5)
|
url1 := helper.RandString(5)
|
||||||
host := helper.RandString(5) + ".com"
|
host := helper.RandString(5) + ".com"
|
||||||
|
|
||||||
helper.CmdShouldPass("git", "clone", "https://github.com/che-samples/web-nodejs-sample.git", projectDirPath)
|
|
||||||
helper.Chdir(projectDirPath)
|
|
||||||
|
|
||||||
helper.CmdShouldPass("odo", "create", "nodejs", "--project", namespace, componentName)
|
helper.CmdShouldPass("odo", "create", "nodejs", "--project", namespace, componentName)
|
||||||
|
|
||||||
helper.CopyExample(filepath.Join("source", "devfiles", "nodejs"), projectDirPath)
|
helper.CopyExample(filepath.Join("source", "devfiles", "nodejs", "project"), context)
|
||||||
|
helper.CopyExampleDevFile(filepath.Join("source", "devfiles", "nodejs", "devfile.yaml"), filepath.Join(context, "devfile.yaml"))
|
||||||
|
|
||||||
helper.CmdShouldPass("odo", "url", "create", url1, "--port", "3000", "--host", host, "--ingress")
|
helper.CmdShouldPass("odo", "url", "create", url1, "--port", "3000", "--host", host, "--ingress")
|
||||||
helper.CmdShouldPass("odo", "push", "--devfile", "devfile.yaml", "--project", namespace)
|
helper.CmdShouldPass("odo", "push", "--devfile", "devfile.yaml", "--project", namespace)
|
||||||
@@ -114,12 +108,10 @@ var _ = Describe("odo devfile url command tests", func() {
|
|||||||
url1 := helper.RandString(5)
|
url1 := helper.RandString(5)
|
||||||
host := helper.RandString(5) + ".com"
|
host := helper.RandString(5) + ".com"
|
||||||
|
|
||||||
helper.CmdShouldPass("git", "clone", "https://github.com/che-samples/web-nodejs-sample.git", projectDirPath)
|
|
||||||
helper.Chdir(projectDirPath)
|
|
||||||
|
|
||||||
helper.CmdShouldPass("odo", "create", "nodejs", "--project", namespace, componentName)
|
helper.CmdShouldPass("odo", "create", "nodejs", "--project", namespace, componentName)
|
||||||
|
|
||||||
helper.CopyExample(filepath.Join("source", "devfiles", "nodejs"), projectDirPath)
|
helper.CopyExample(filepath.Join("source", "devfiles", "nodejs", "project"), context)
|
||||||
|
helper.CopyExampleDevFile(filepath.Join("source", "devfiles", "nodejs", "devfile.yaml"), filepath.Join(context, "devfile.yaml"))
|
||||||
|
|
||||||
helper.CmdShouldPass("odo", "url", "create", url1, "--port", "3000", "--host", host, "--secure", "--ingress")
|
helper.CmdShouldPass("odo", "url", "create", url1, "--port", "3000", "--host", host, "--secure", "--ingress")
|
||||||
|
|
||||||
@@ -139,12 +131,10 @@ var _ = Describe("odo devfile url command tests", func() {
|
|||||||
url1 := helper.RandString(5)
|
url1 := helper.RandString(5)
|
||||||
host := helper.RandString(5) + ".com"
|
host := helper.RandString(5) + ".com"
|
||||||
|
|
||||||
helper.CmdShouldPass("git", "clone", "https://github.com/che-samples/web-nodejs-sample.git", projectDirPath)
|
|
||||||
helper.Chdir(projectDirPath)
|
|
||||||
|
|
||||||
helper.CmdShouldPass("odo", "create", "nodejs", "--project", namespace, componentName)
|
helper.CmdShouldPass("odo", "create", "nodejs", "--project", namespace, componentName)
|
||||||
|
|
||||||
helper.CopyExample(filepath.Join("source", "devfiles", "nodejs"), projectDirPath)
|
helper.CopyExample(filepath.Join("source", "devfiles", "nodejs", "project"), context)
|
||||||
|
helper.CopyExampleDevFile(filepath.Join("source", "devfiles", "nodejs", "devfile.yaml"), filepath.Join(context, "devfile.yaml"))
|
||||||
|
|
||||||
stdout = helper.CmdShouldPass("odo", "url", "create", url1, "--port", "3000", "--host", host, "--now", "--ingress", "--devfile", "devfile.yaml")
|
stdout = helper.CmdShouldPass("odo", "url", "create", url1, "--port", "3000", "--host", host, "--now", "--ingress", "--devfile", "devfile.yaml")
|
||||||
helper.MatchAllInOutput(stdout, []string{"URL " + url1 + " created for component", "http:", url1 + "." + host})
|
helper.MatchAllInOutput(stdout, []string{"URL " + url1 + " created for component", "http:", url1 + "." + host})
|
||||||
@@ -158,12 +148,10 @@ var _ = Describe("odo devfile url command tests", func() {
|
|||||||
|
|
||||||
url1 := helper.RandString(5)
|
url1 := helper.RandString(5)
|
||||||
|
|
||||||
helper.CmdShouldPass("git", "clone", "https://github.com/che-samples/web-nodejs-sample.git", projectDirPath)
|
|
||||||
helper.Chdir(projectDirPath)
|
|
||||||
|
|
||||||
helper.CmdShouldPass("odo", "create", "nodejs", "--project", namespace, componentName)
|
helper.CmdShouldPass("odo", "create", "nodejs", "--project", namespace, componentName)
|
||||||
|
|
||||||
helper.CopyExample(filepath.Join("source", "devfiles", "nodejs"), projectDirPath)
|
helper.CopyExample(filepath.Join("source", "devfiles", "nodejs", "project"), context)
|
||||||
|
helper.CopyExampleDevFile(filepath.Join("source", "devfiles", "nodejs", "devfile.yaml"), filepath.Join(context, "devfile.yaml"))
|
||||||
|
|
||||||
helper.CmdShouldPass("odo", "url", "create", url1)
|
helper.CmdShouldPass("odo", "url", "create", url1)
|
||||||
|
|
||||||
@@ -208,12 +196,10 @@ var _ = Describe("odo devfile url command tests", func() {
|
|||||||
url1 := helper.RandString(5)
|
url1 := helper.RandString(5)
|
||||||
host := helper.RandString(5) + ".com"
|
host := helper.RandString(5) + ".com"
|
||||||
|
|
||||||
helper.CmdShouldPass("git", "clone", "https://github.com/che-samples/web-nodejs-sample.git", projectDirPath)
|
|
||||||
helper.Chdir(projectDirPath)
|
|
||||||
|
|
||||||
helper.CmdShouldPass("odo", "create", "nodejs", "--project", namespace, componentName)
|
helper.CmdShouldPass("odo", "create", "nodejs", "--project", namespace, componentName)
|
||||||
|
|
||||||
helper.CopyExample(filepath.Join("source", "devfiles", "nodejs"), projectDirPath)
|
helper.CopyExample(filepath.Join("source", "devfiles", "nodejs", "project"), context)
|
||||||
|
helper.CopyExampleDevFile(filepath.Join("source", "devfiles", "nodejs", "devfile.yaml"), filepath.Join(context, "devfile.yaml"))
|
||||||
|
|
||||||
helper.CmdShouldPass("odo", "url", "create", url1, "--port", "3000", "--host", host, "--ingress")
|
helper.CmdShouldPass("odo", "url", "create", url1, "--port", "3000", "--host", host, "--ingress")
|
||||||
|
|
||||||
@@ -239,12 +225,10 @@ var _ = Describe("odo devfile url command tests", func() {
|
|||||||
url1 := helper.RandString(5)
|
url1 := helper.RandString(5)
|
||||||
host := helper.RandString(5) + ".com"
|
host := helper.RandString(5) + ".com"
|
||||||
|
|
||||||
helper.CmdShouldPass("git", "clone", "https://github.com/che-samples/web-nodejs-sample.git", projectDirPath)
|
|
||||||
helper.Chdir(projectDirPath)
|
|
||||||
|
|
||||||
helper.CmdShouldPass("odo", "create", "nodejs", "--project", namespace, componentName)
|
helper.CmdShouldPass("odo", "create", "nodejs", "--project", namespace, componentName)
|
||||||
|
|
||||||
helper.CopyExample(filepath.Join("source", "devfiles", "nodejs"), projectDirPath)
|
helper.CopyExample(filepath.Join("source", "devfiles", "nodejs", "project"), context)
|
||||||
|
helper.CopyExampleDevFile(filepath.Join("source", "devfiles", "nodejs", "devfile.yaml"), filepath.Join(context, "devfile.yaml"))
|
||||||
|
|
||||||
helper.CmdShouldPass("odo", "url", "create", url1, "--port", "3000", "--host", host, "--ingress")
|
helper.CmdShouldPass("odo", "url", "create", url1, "--port", "3000", "--host", host, "--ingress")
|
||||||
|
|
||||||
|
|||||||
@@ -14,8 +14,6 @@ var _ = Describe("odo docker devfile delete command tests", func() {
|
|||||||
var context string
|
var context string
|
||||||
var currentWorkingDirectory string
|
var currentWorkingDirectory string
|
||||||
var cmpName string
|
var cmpName string
|
||||||
var projectDir = "/projectDir"
|
|
||||||
var projectDirPath string
|
|
||||||
|
|
||||||
dockerClient := helper.NewDockerRunner("docker")
|
dockerClient := helper.NewDockerRunner("docker")
|
||||||
|
|
||||||
@@ -25,7 +23,6 @@ var _ = Describe("odo docker devfile delete command tests", func() {
|
|||||||
context = helper.CreateNewContext()
|
context = helper.CreateNewContext()
|
||||||
currentWorkingDirectory = helper.Getwd()
|
currentWorkingDirectory = helper.Getwd()
|
||||||
cmpName = helper.RandString(6)
|
cmpName = helper.RandString(6)
|
||||||
projectDirPath = context + projectDir
|
|
||||||
helper.Chdir(context)
|
helper.Chdir(context)
|
||||||
os.Setenv("GLOBALODOCONFIG", filepath.Join(context, "config.yaml"))
|
os.Setenv("GLOBALODOCONFIG", filepath.Join(context, "config.yaml"))
|
||||||
|
|
||||||
@@ -53,12 +50,11 @@ var _ = Describe("odo docker devfile delete command tests", func() {
|
|||||||
Context("when docker devfile delete command is executed", func() {
|
Context("when docker devfile delete command is executed", func() {
|
||||||
|
|
||||||
It("should delete the component created from the devfile and also the owned resources", func() {
|
It("should delete the component created from the devfile and also the owned resources", func() {
|
||||||
|
|
||||||
helper.CmdShouldPass("git", "clone", "https://github.com/che-samples/web-nodejs-sample.git", projectDirPath)
|
|
||||||
helper.Chdir(projectDirPath)
|
|
||||||
|
|
||||||
helper.CmdShouldPass("odo", "create", "nodejs", cmpName)
|
helper.CmdShouldPass("odo", "create", "nodejs", cmpName)
|
||||||
|
|
||||||
|
helper.CopyExample(filepath.Join("source", "devfiles", "nodejs", "project"), context)
|
||||||
|
helper.CopyExampleDevFile(filepath.Join("source", "devfiles", "nodejs", "devfile.yaml"), filepath.Join(context, "devfile.yaml"))
|
||||||
|
|
||||||
helper.CmdShouldPass("odo", "push", "--devfile", "devfile.yaml")
|
helper.CmdShouldPass("odo", "push", "--devfile", "devfile.yaml")
|
||||||
|
|
||||||
Expect(dockerClient.GetRunningContainersByLabel("component=" + cmpName)).To(HaveLen(1))
|
Expect(dockerClient.GetRunningContainersByLabel("component=" + cmpName)).To(HaveLen(1))
|
||||||
@@ -77,12 +73,11 @@ var _ = Describe("odo docker devfile delete command tests", func() {
|
|||||||
Context("when docker devfile delete command is executed with all flag", func() {
|
Context("when docker devfile delete command is executed with all flag", func() {
|
||||||
|
|
||||||
It("should delete the component created from the devfile and also the env folder", func() {
|
It("should delete the component created from the devfile and also the env folder", func() {
|
||||||
|
|
||||||
helper.CmdShouldPass("git", "clone", "https://github.com/che-samples/web-nodejs-sample.git", projectDirPath)
|
|
||||||
helper.Chdir(projectDirPath)
|
|
||||||
|
|
||||||
helper.CmdShouldPass("odo", "create", "nodejs", cmpName)
|
helper.CmdShouldPass("odo", "create", "nodejs", cmpName)
|
||||||
|
|
||||||
|
helper.CopyExample(filepath.Join("source", "devfiles", "nodejs", "project"), context)
|
||||||
|
helper.CopyExampleDevFile(filepath.Join("source", "devfiles", "nodejs", "devfile.yaml"), filepath.Join(context, "devfile.yaml"))
|
||||||
|
|
||||||
helper.CmdShouldPass("odo", "push", "--devfile", "devfile.yaml")
|
helper.CmdShouldPass("odo", "push", "--devfile", "devfile.yaml")
|
||||||
|
|
||||||
Expect(dockerClient.GetRunningContainersByLabel("component=" + cmpName)).To(HaveLen(1))
|
Expect(dockerClient.GetRunningContainersByLabel("component=" + cmpName)).To(HaveLen(1))
|
||||||
@@ -95,7 +90,7 @@ var _ = Describe("odo docker devfile delete command tests", func() {
|
|||||||
|
|
||||||
Expect(dockerClient.ListVolumesOfComponentAndType(cmpName, "projects")).To(HaveLen(0))
|
Expect(dockerClient.ListVolumesOfComponentAndType(cmpName, "projects")).To(HaveLen(0))
|
||||||
|
|
||||||
files := helper.ListFilesInDir(projectDirPath)
|
files := helper.ListFilesInDir(context)
|
||||||
Expect(files).To(Not(ContainElement(".odo")))
|
Expect(files).To(Not(ContainElement(".odo")))
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -13,8 +13,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var _ = Describe("odo docker devfile push command tests", func() {
|
var _ = Describe("odo docker devfile push command tests", func() {
|
||||||
var context, currentWorkingDirectory, cmpName, projectDirPath string
|
var context, currentWorkingDirectory, cmpName string
|
||||||
var projectDir = "/projectDir"
|
|
||||||
var sourcePath = "/projects/nodejs-web-app"
|
var sourcePath = "/projects/nodejs-web-app"
|
||||||
|
|
||||||
dockerClient := helper.NewDockerRunner("docker")
|
dockerClient := helper.NewDockerRunner("docker")
|
||||||
@@ -24,7 +23,6 @@ var _ = Describe("odo docker devfile push command tests", func() {
|
|||||||
SetDefaultEventuallyTimeout(10 * time.Minute)
|
SetDefaultEventuallyTimeout(10 * time.Minute)
|
||||||
context = helper.CreateNewContext()
|
context = helper.CreateNewContext()
|
||||||
currentWorkingDirectory = helper.Getwd()
|
currentWorkingDirectory = helper.Getwd()
|
||||||
projectDirPath = context + projectDir
|
|
||||||
cmpName = helper.RandString(6)
|
cmpName = helper.RandString(6)
|
||||||
helper.Chdir(context)
|
helper.Chdir(context)
|
||||||
os.Setenv("GLOBALODOCONFIG", filepath.Join(context, "config.yaml"))
|
os.Setenv("GLOBALODOCONFIG", filepath.Join(context, "config.yaml"))
|
||||||
@@ -109,13 +107,13 @@ var _ = Describe("odo docker devfile push command tests", func() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
It("should not build when no changes are detected in the directory and build when a file change is detected", func() {
|
It("should not build when no changes are detected in the directory and build when a file change is detected", func() {
|
||||||
utils.ExecPushToTestFileChanges(projectDirPath, cmpName, "")
|
utils.ExecPushToTestFileChanges(context, cmpName, "")
|
||||||
})
|
})
|
||||||
|
|
||||||
It("should be able to create a file, push, delete, then push again propagating the deletions", func() {
|
It("should be able to create a file, push, delete, then push again propagating the deletions", func() {
|
||||||
newFilePath := filepath.Join(projectDirPath, "foobar.txt")
|
newFilePath := filepath.Join(context, "foobar.txt")
|
||||||
newDirPath := filepath.Join(projectDirPath, "testdir")
|
newDirPath := filepath.Join(context, "testdir")
|
||||||
utils.ExecPushWithNewFileAndDir(projectDirPath, cmpName, "", newFilePath, newDirPath)
|
utils.ExecPushWithNewFileAndDir(context, cmpName, "", newFilePath, newDirPath)
|
||||||
|
|
||||||
// Check to see if it's been pushed (foobar.txt abd directory testdir)
|
// Check to see if it's been pushed (foobar.txt abd directory testdir)
|
||||||
containers := dockerClient.GetRunningContainersByCompAlias(cmpName, "runtime")
|
containers := dockerClient.GetRunningContainersByCompAlias(cmpName, "runtime")
|
||||||
@@ -137,11 +135,11 @@ var _ = Describe("odo docker devfile push command tests", func() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
It("should build when no changes are detected in the directory and force flag is enabled", func() {
|
It("should build when no changes are detected in the directory and force flag is enabled", func() {
|
||||||
utils.ExecPushWithForceFlag(projectDirPath, cmpName, "")
|
utils.ExecPushWithForceFlag(context, cmpName, "")
|
||||||
})
|
})
|
||||||
|
|
||||||
It("should execute the default devbuild and devrun commands if present", func() {
|
It("should execute the default devbuild and devrun commands if present", func() {
|
||||||
utils.ExecDefaultDevfileCommands(projectDirPath, cmpName, "")
|
utils.ExecDefaultDevfileCommands(context, cmpName, "")
|
||||||
|
|
||||||
// Check to see if it's been pushed (foobar.txt abd directory testdir)
|
// Check to see if it's been pushed (foobar.txt abd directory testdir)
|
||||||
containers := dockerClient.GetRunningContainersByCompAlias(cmpName, "runtime")
|
containers := dockerClient.GetRunningContainersByCompAlias(cmpName, "runtime")
|
||||||
@@ -152,15 +150,12 @@ var _ = Describe("odo docker devfile push command tests", func() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
It("should execute the optional devinit, and devrun commands if present", func() {
|
It("should execute the optional devinit, and devrun commands if present", func() {
|
||||||
|
|
||||||
helper.CmdShouldPass("git", "clone", "https://github.com/maysunfaisal/springboot.git", projectDirPath)
|
|
||||||
helper.Chdir(projectDirPath)
|
|
||||||
|
|
||||||
helper.CmdShouldPass("odo", "create", "java-spring-boot", cmpName)
|
helper.CmdShouldPass("odo", "create", "java-spring-boot", cmpName)
|
||||||
|
|
||||||
helper.CopyExample(filepath.Join("source", "devfiles", "springboot"), projectDirPath)
|
helper.CopyExample(filepath.Join("source", "devfiles", "springboot", "project"), context)
|
||||||
|
helper.CopyExampleDevFile(filepath.Join("source", "devfiles", "springboot", "devfile-init.yaml"), filepath.Join(context, "devfile.yaml"))
|
||||||
|
|
||||||
output := helper.CmdShouldPass("odo", "push", "--devfile", "devfile-init.yaml")
|
output := helper.CmdShouldPass("odo", "push", "--devfile", "devfile.yaml")
|
||||||
Expect(output).To(ContainSubstring("Executing devinit command \"echo hello"))
|
Expect(output).To(ContainSubstring("Executing devinit command \"echo hello"))
|
||||||
Expect(output).To(ContainSubstring("Executing devbuild command \"/artifacts/bin/build-container-full.sh\""))
|
Expect(output).To(ContainSubstring("Executing devbuild command \"/artifacts/bin/build-container-full.sh\""))
|
||||||
Expect(output).To(ContainSubstring("Executing devrun command \"/artifacts/bin/start-server.sh\""))
|
Expect(output).To(ContainSubstring("Executing devrun command \"/artifacts/bin/start-server.sh\""))
|
||||||
@@ -174,15 +169,12 @@ var _ = Describe("odo docker devfile push command tests", func() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
It("should execute devinit and devrun commands if present", func() {
|
It("should execute devinit and devrun commands if present", func() {
|
||||||
|
|
||||||
helper.CmdShouldPass("git", "clone", "https://github.com/maysunfaisal/springboot.git", projectDirPath)
|
|
||||||
helper.Chdir(projectDirPath)
|
|
||||||
|
|
||||||
helper.CmdShouldPass("odo", "create", "java-spring-boot", cmpName)
|
helper.CmdShouldPass("odo", "create", "java-spring-boot", cmpName)
|
||||||
|
|
||||||
helper.CopyExample(filepath.Join("source", "devfiles", "springboot"), projectDirPath)
|
helper.CopyExample(filepath.Join("source", "devfiles", "springboot", "project"), context)
|
||||||
|
helper.CopyExampleDevFile(filepath.Join("source", "devfiles", "springboot", "devfile-init-without-build.yaml"), filepath.Join(context, "devfile.yaml"))
|
||||||
|
|
||||||
output := helper.CmdShouldPass("odo", "push", "--devfile", "devfile-init-without-build.yaml")
|
output := helper.CmdShouldPass("odo", "push", "--devfile", "devfile.yaml")
|
||||||
Expect(output).To(ContainSubstring("Executing devinit command \"echo hello"))
|
Expect(output).To(ContainSubstring("Executing devinit command \"echo hello"))
|
||||||
Expect(output).To(ContainSubstring("Executing devrun command \"/artifacts/bin/start-server.sh\""))
|
Expect(output).To(ContainSubstring("Executing devrun command \"/artifacts/bin/start-server.sh\""))
|
||||||
|
|
||||||
@@ -195,19 +187,19 @@ var _ = Describe("odo docker devfile push command tests", func() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
It("should be able to handle a missing devbuild command", func() {
|
It("should be able to handle a missing devbuild command", func() {
|
||||||
utils.ExecWithMissingBuildCommand(projectDirPath, cmpName, "")
|
utils.ExecWithMissingBuildCommand(context, cmpName, "")
|
||||||
})
|
})
|
||||||
|
|
||||||
It("should error out on a missing devrun command", func() {
|
It("should error out on a missing devrun command", func() {
|
||||||
utils.ExecWithMissingRunCommand(projectDirPath, cmpName, "")
|
utils.ExecWithMissingRunCommand(context, cmpName, "")
|
||||||
})
|
})
|
||||||
|
|
||||||
It("should be able to push using the custom commands", func() {
|
It("should be able to push using the custom commands", func() {
|
||||||
utils.ExecWithCustomCommand(projectDirPath, cmpName, "")
|
utils.ExecWithCustomCommand(context, cmpName, "")
|
||||||
})
|
})
|
||||||
|
|
||||||
It("should error out on a wrong custom commands", func() {
|
It("should error out on a wrong custom commands", func() {
|
||||||
utils.ExecWithWrongCustomCommand(projectDirPath, cmpName, "")
|
utils.ExecWithWrongCustomCommand(context, cmpName, "")
|
||||||
})
|
})
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -13,8 +13,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var _ = Describe("odo docker devfile url command tests", func() {
|
var _ = Describe("odo docker devfile url command tests", func() {
|
||||||
var projectDirPath, context, currentWorkingDirectory, cmpName string
|
var context, currentWorkingDirectory, cmpName string
|
||||||
var projectDir = "/projectDir"
|
|
||||||
dockerClient := helper.NewDockerRunner("docker")
|
dockerClient := helper.NewDockerRunner("docker")
|
||||||
|
|
||||||
// This is run after every Spec (It)
|
// This is run after every Spec (It)
|
||||||
@@ -22,7 +21,6 @@ var _ = Describe("odo docker devfile url command tests", func() {
|
|||||||
SetDefaultEventuallyTimeout(10 * time.Minute)
|
SetDefaultEventuallyTimeout(10 * time.Minute)
|
||||||
context = helper.CreateNewContext()
|
context = helper.CreateNewContext()
|
||||||
currentWorkingDirectory = helper.Getwd()
|
currentWorkingDirectory = helper.Getwd()
|
||||||
projectDirPath = context + projectDir
|
|
||||||
cmpName = helper.RandString(6)
|
cmpName = helper.RandString(6)
|
||||||
helper.Chdir(context)
|
helper.Chdir(context)
|
||||||
os.Setenv("GLOBALODOCONFIG", filepath.Join(context, "config.yaml"))
|
os.Setenv("GLOBALODOCONFIG", filepath.Join(context, "config.yaml"))
|
||||||
@@ -45,10 +43,11 @@ var _ = Describe("odo docker devfile url command tests", func() {
|
|||||||
Context("Creating urls", func() {
|
Context("Creating urls", func() {
|
||||||
It("create should pass", func() {
|
It("create should pass", func() {
|
||||||
var stdout string
|
var stdout string
|
||||||
helper.CmdShouldPass("git", "clone", "https://github.com/che-samples/web-nodejs-sample.git", projectDirPath)
|
|
||||||
helper.Chdir(projectDirPath)
|
|
||||||
|
|
||||||
helper.CmdShouldPass("odo", "create", "nodejs", cmpName)
|
helper.CmdShouldPass("odo", "create", "nodejs", cmpName)
|
||||||
|
|
||||||
|
helper.CopyExample(filepath.Join("source", "devfiles", "nodejs", "project"), context)
|
||||||
|
helper.CopyExampleDevFile(filepath.Join("source", "devfiles", "nodejs", "devfile.yaml"), filepath.Join(context, "devfile.yaml"))
|
||||||
|
|
||||||
stdout = helper.CmdShouldPass("odo", "url", "create")
|
stdout = helper.CmdShouldPass("odo", "url", "create")
|
||||||
helper.MatchAllInOutput(stdout, []string{cmpName + "-3000", "created for component"})
|
helper.MatchAllInOutput(stdout, []string{cmpName + "-3000", "created for component"})
|
||||||
stdout = helper.CmdShouldPass("odo", "push", "--devfile", "devfile.yaml")
|
stdout = helper.CmdShouldPass("odo", "push", "--devfile", "devfile.yaml")
|
||||||
@@ -58,10 +57,12 @@ var _ = Describe("odo docker devfile url command tests", func() {
|
|||||||
It("create with now flag should pass", func() {
|
It("create with now flag should pass", func() {
|
||||||
var stdout string
|
var stdout string
|
||||||
url1 := helper.RandString(5)
|
url1 := helper.RandString(5)
|
||||||
helper.CmdShouldPass("git", "clone", "https://github.com/che-samples/web-nodejs-sample.git", projectDirPath)
|
|
||||||
helper.Chdir(projectDirPath)
|
|
||||||
|
|
||||||
helper.CmdShouldPass("odo", "create", "nodejs", cmpName)
|
helper.CmdShouldPass("odo", "create", "nodejs", cmpName)
|
||||||
|
|
||||||
|
helper.CopyExample(filepath.Join("source", "devfiles", "nodejs", "project"), context)
|
||||||
|
helper.CopyExampleDevFile(filepath.Join("source", "devfiles", "nodejs", "devfile.yaml"), filepath.Join(context, "devfile.yaml"))
|
||||||
|
|
||||||
stdout = helper.CmdShouldPass("odo", "url", "create", url1, "--now")
|
stdout = helper.CmdShouldPass("odo", "url", "create", url1, "--now")
|
||||||
helper.MatchAllInOutput(stdout, []string{url1, "created for component", "Changes successfully pushed to component"})
|
helper.MatchAllInOutput(stdout, []string{url1, "created for component", "Changes successfully pushed to component"})
|
||||||
})
|
})
|
||||||
@@ -69,10 +70,12 @@ var _ = Describe("odo docker devfile url command tests", func() {
|
|||||||
It("create with same url name should fail", func() {
|
It("create with same url name should fail", func() {
|
||||||
var stdout string
|
var stdout string
|
||||||
url1 := helper.RandString(5)
|
url1 := helper.RandString(5)
|
||||||
helper.CmdShouldPass("git", "clone", "https://github.com/che-samples/web-nodejs-sample.git", projectDirPath)
|
|
||||||
helper.Chdir(projectDirPath)
|
|
||||||
|
|
||||||
helper.CmdShouldPass("odo", "create", "nodejs", cmpName)
|
helper.CmdShouldPass("odo", "create", "nodejs", cmpName)
|
||||||
|
|
||||||
|
helper.CopyExample(filepath.Join("source", "devfiles", "nodejs", "project"), context)
|
||||||
|
helper.CopyExampleDevFile(filepath.Join("source", "devfiles", "nodejs", "devfile.yaml"), filepath.Join(context, "devfile.yaml"))
|
||||||
|
|
||||||
helper.CmdShouldPass("odo", "url", "create", url1)
|
helper.CmdShouldPass("odo", "url", "create", url1)
|
||||||
|
|
||||||
stdout = helper.CmdShouldFail("odo", "url", "create", url1)
|
stdout = helper.CmdShouldFail("odo", "url", "create", url1)
|
||||||
@@ -81,11 +84,11 @@ var _ = Describe("odo docker devfile url command tests", func() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
It("should be able to do a GET on the URL after a successful push", func() {
|
It("should be able to do a GET on the URL after a successful push", func() {
|
||||||
helper.CmdShouldPass("git", "clone", "https://github.com/che-samples/web-nodejs-sample.git", projectDirPath)
|
|
||||||
helper.Chdir(projectDirPath)
|
|
||||||
|
|
||||||
helper.CmdShouldPass("odo", "create", "nodejs", cmpName)
|
helper.CmdShouldPass("odo", "create", "nodejs", cmpName)
|
||||||
|
|
||||||
|
helper.CopyExample(filepath.Join("source", "devfiles", "nodejs", "project"), context)
|
||||||
|
helper.CopyExampleDevFile(filepath.Join("source", "devfiles", "nodejs", "devfile.yaml"), filepath.Join(context, "devfile.yaml"))
|
||||||
|
|
||||||
helper.CmdShouldPass("odo", "url", "create", cmpName)
|
helper.CmdShouldPass("odo", "url", "create", cmpName)
|
||||||
|
|
||||||
output := helper.CmdShouldPass("odo", "push", "--devfile", "devfile.yaml")
|
output := helper.CmdShouldPass("odo", "push", "--devfile", "devfile.yaml")
|
||||||
@@ -100,10 +103,12 @@ var _ = Describe("odo docker devfile url command tests", func() {
|
|||||||
Context("Switching pushtarget", func() {
|
Context("Switching pushtarget", func() {
|
||||||
It("switch from docker to kube, odo push should display warning", func() {
|
It("switch from docker to kube, odo push should display warning", func() {
|
||||||
var stdout string
|
var stdout string
|
||||||
helper.CmdShouldPass("git", "clone", "https://github.com/che-samples/web-nodejs-sample.git", projectDirPath)
|
|
||||||
helper.Chdir(projectDirPath)
|
|
||||||
|
|
||||||
helper.CmdShouldPass("odo", "create", "nodejs", cmpName)
|
helper.CmdShouldPass("odo", "create", "nodejs", cmpName)
|
||||||
|
|
||||||
|
helper.CopyExample(filepath.Join("source", "devfiles", "nodejs", "project"), context)
|
||||||
|
helper.CopyExampleDevFile(filepath.Join("source", "devfiles", "nodejs", "devfile.yaml"), filepath.Join(context, "devfile.yaml"))
|
||||||
|
|
||||||
helper.CmdShouldPass("odo", "url", "create")
|
helper.CmdShouldPass("odo", "url", "create")
|
||||||
|
|
||||||
helper.CmdShouldPass("odo", "preference", "set", "pushtarget", "kube", "-f")
|
helper.CmdShouldPass("odo", "preference", "set", "pushtarget", "kube", "-f")
|
||||||
@@ -116,10 +121,12 @@ var _ = Describe("odo docker devfile url command tests", func() {
|
|||||||
|
|
||||||
It("switch from kube to docker, odo push should display warning", func() {
|
It("switch from kube to docker, odo push should display warning", func() {
|
||||||
var stdout string
|
var stdout string
|
||||||
helper.CmdShouldPass("git", "clone", "https://github.com/che-samples/web-nodejs-sample.git", projectDirPath)
|
|
||||||
helper.Chdir(projectDirPath)
|
|
||||||
helper.CmdShouldPass("odo", "preference", "set", "pushtarget", "kube", "-f")
|
helper.CmdShouldPass("odo", "preference", "set", "pushtarget", "kube", "-f")
|
||||||
helper.CmdShouldPass("odo", "create", "nodejs", cmpName)
|
helper.CmdShouldPass("odo", "create", "nodejs", cmpName)
|
||||||
|
|
||||||
|
helper.CopyExample(filepath.Join("source", "devfiles", "nodejs", "project"), context)
|
||||||
|
helper.CopyExampleDevFile(filepath.Join("source", "devfiles", "nodejs", "devfile.yaml"), filepath.Join(context, "devfile.yaml"))
|
||||||
|
|
||||||
helper.CmdShouldPass("odo", "url", "create", "--host", "1.2.3.4.com", "--ingress")
|
helper.CmdShouldPass("odo", "url", "create", "--host", "1.2.3.4.com", "--ingress")
|
||||||
|
|
||||||
helper.CmdShouldPass("odo", "preference", "set", "pushtarget", "docker", "-f")
|
helper.CmdShouldPass("odo", "preference", "set", "pushtarget", "docker", "-f")
|
||||||
|
|||||||
@@ -19,13 +19,13 @@ func useProjectIfAvailable(args []string, project string) []string {
|
|||||||
|
|
||||||
// ExecDefaultDevfileCommands executes the default devfile commands
|
// ExecDefaultDevfileCommands executes the default devfile commands
|
||||||
func ExecDefaultDevfileCommands(projectDirPath, cmpName, namespace string) {
|
func ExecDefaultDevfileCommands(projectDirPath, cmpName, namespace string) {
|
||||||
helper.CmdShouldPass("git", "clone", "https://github.com/maysunfaisal/springboot.git", projectDirPath)
|
|
||||||
helper.Chdir(projectDirPath)
|
|
||||||
|
|
||||||
args := []string{"create", "java-spring-boot", cmpName}
|
args := []string{"create", "java-spring-boot", cmpName}
|
||||||
args = useProjectIfAvailable(args, namespace)
|
args = useProjectIfAvailable(args, namespace)
|
||||||
helper.CmdShouldPass("odo", args...)
|
helper.CmdShouldPass("odo", args...)
|
||||||
|
|
||||||
|
helper.CopyExample(filepath.Join("source", "devfiles", "springboot", "project"), projectDirPath)
|
||||||
|
helper.CopyExampleDevFile(filepath.Join("source", "devfiles", "springboot", "devfile.yaml"), filepath.Join(projectDirPath, "devfile.yaml"))
|
||||||
|
|
||||||
args = []string{"push", "--devfile", "devfile.yaml"}
|
args = []string{"push", "--devfile", "devfile.yaml"}
|
||||||
args = useProjectIfAvailable(args, namespace)
|
args = useProjectIfAvailable(args, namespace)
|
||||||
output := helper.CmdShouldPass("odo", args...)
|
output := helper.CmdShouldPass("odo", args...)
|
||||||
@@ -35,13 +35,11 @@ func ExecDefaultDevfileCommands(projectDirPath, cmpName, namespace string) {
|
|||||||
|
|
||||||
// ExecWithMissingBuildCommand executes odo push with a missing build command
|
// ExecWithMissingBuildCommand executes odo push with a missing build command
|
||||||
func ExecWithMissingBuildCommand(projectDirPath, cmpName, namespace string) {
|
func ExecWithMissingBuildCommand(projectDirPath, cmpName, namespace string) {
|
||||||
helper.CmdShouldPass("git", "clone", "https://github.com/che-samples/web-nodejs-sample.git", projectDirPath)
|
|
||||||
helper.Chdir(projectDirPath)
|
|
||||||
|
|
||||||
args := []string{"create", "nodejs", cmpName}
|
args := []string{"create", "nodejs", cmpName}
|
||||||
args = useProjectIfAvailable(args, namespace)
|
args = useProjectIfAvailable(args, namespace)
|
||||||
helper.CmdShouldPass("odo", args...)
|
helper.CmdShouldPass("odo", args...)
|
||||||
|
|
||||||
|
helper.CopyExample(filepath.Join("source", "devfiles", "nodejs", "project"), projectDirPath)
|
||||||
helper.CopyExampleDevFile(filepath.Join("source", "devfiles", "nodejs", "devfile-without-devbuild.yaml"), filepath.Join(projectDirPath, "devfile.yaml"))
|
helper.CopyExampleDevFile(filepath.Join("source", "devfiles", "nodejs", "devfile-without-devbuild.yaml"), filepath.Join(projectDirPath, "devfile.yaml"))
|
||||||
|
|
||||||
args = []string{"push", "--devfile", "devfile.yaml"}
|
args = []string{"push", "--devfile", "devfile.yaml"}
|
||||||
@@ -53,14 +51,12 @@ func ExecWithMissingBuildCommand(projectDirPath, cmpName, namespace string) {
|
|||||||
|
|
||||||
// ExecWithMissingRunCommand executes odo push with a missing run command
|
// ExecWithMissingRunCommand executes odo push with a missing run command
|
||||||
func ExecWithMissingRunCommand(projectDirPath, cmpName, namespace string) {
|
func ExecWithMissingRunCommand(projectDirPath, cmpName, namespace string) {
|
||||||
helper.CmdShouldPass("git", "clone", "https://github.com/che-samples/web-nodejs-sample.git", projectDirPath)
|
|
||||||
helper.Chdir(projectDirPath)
|
|
||||||
|
|
||||||
args := []string{"create", "nodejs", cmpName}
|
args := []string{"create", "nodejs", cmpName}
|
||||||
args = useProjectIfAvailable(args, namespace)
|
args = useProjectIfAvailable(args, namespace)
|
||||||
helper.CmdShouldPass("odo", args...)
|
helper.CmdShouldPass("odo", args...)
|
||||||
|
|
||||||
helper.CopyExample(filepath.Join("source", "devfiles", "nodejs"), projectDirPath)
|
helper.CopyExample(filepath.Join("source", "devfiles", "nodejs", "project"), projectDirPath)
|
||||||
|
helper.CopyExampleDevFile(filepath.Join("source", "devfiles", "nodejs", "devfile.yaml"), filepath.Join(projectDirPath, "devfile.yaml"))
|
||||||
|
|
||||||
// Rename the devrun command
|
// Rename the devrun command
|
||||||
helper.ReplaceString(filepath.Join(projectDirPath, "devfile.yaml"), "devrun", "randomcommand")
|
helper.ReplaceString(filepath.Join(projectDirPath, "devfile.yaml"), "devrun", "randomcommand")
|
||||||
@@ -74,14 +70,12 @@ func ExecWithMissingRunCommand(projectDirPath, cmpName, namespace string) {
|
|||||||
|
|
||||||
// ExecWithCustomCommand executes odo push with a custom command
|
// ExecWithCustomCommand executes odo push with a custom command
|
||||||
func ExecWithCustomCommand(projectDirPath, cmpName, namespace string) {
|
func ExecWithCustomCommand(projectDirPath, cmpName, namespace string) {
|
||||||
helper.CmdShouldPass("git", "clone", "https://github.com/che-samples/web-nodejs-sample.git", projectDirPath)
|
|
||||||
helper.Chdir(projectDirPath)
|
|
||||||
|
|
||||||
args := []string{"create", "nodejs", cmpName}
|
args := []string{"create", "nodejs", cmpName}
|
||||||
args = useProjectIfAvailable(args, namespace)
|
args = useProjectIfAvailable(args, namespace)
|
||||||
helper.CmdShouldPass("odo", args...)
|
helper.CmdShouldPass("odo", args...)
|
||||||
|
|
||||||
helper.CopyExample(filepath.Join("source", "devfiles", "nodejs"), projectDirPath)
|
helper.CopyExample(filepath.Join("source", "devfiles", "nodejs", "project"), projectDirPath)
|
||||||
|
helper.CopyExampleDevFile(filepath.Join("source", "devfiles", "nodejs", "devfile.yaml"), filepath.Join(projectDirPath, "devfile.yaml"))
|
||||||
|
|
||||||
args = []string{"push", "--devfile", "devfile.yaml", "--build-command", "build", "--run-command", "run"}
|
args = []string{"push", "--devfile", "devfile.yaml", "--build-command", "build", "--run-command", "run"}
|
||||||
args = useProjectIfAvailable(args, namespace)
|
args = useProjectIfAvailable(args, namespace)
|
||||||
@@ -94,14 +88,12 @@ func ExecWithCustomCommand(projectDirPath, cmpName, namespace string) {
|
|||||||
func ExecWithWrongCustomCommand(projectDirPath, cmpName, namespace string) {
|
func ExecWithWrongCustomCommand(projectDirPath, cmpName, namespace string) {
|
||||||
garbageCommand := "buildgarbage"
|
garbageCommand := "buildgarbage"
|
||||||
|
|
||||||
helper.CmdShouldPass("git", "clone", "https://github.com/che-samples/web-nodejs-sample.git", projectDirPath)
|
|
||||||
helper.Chdir(projectDirPath)
|
|
||||||
|
|
||||||
args := []string{"create", "nodejs", cmpName}
|
args := []string{"create", "nodejs", cmpName}
|
||||||
args = useProjectIfAvailable(args, namespace)
|
args = useProjectIfAvailable(args, namespace)
|
||||||
helper.CmdShouldPass("odo", args...)
|
helper.CmdShouldPass("odo", args...)
|
||||||
|
|
||||||
helper.CopyExample(filepath.Join("source", "devfiles", "nodejs"), projectDirPath)
|
helper.CopyExample(filepath.Join("source", "devfiles", "nodejs", "project"), projectDirPath)
|
||||||
|
helper.CopyExampleDevFile(filepath.Join("source", "devfiles", "nodejs", "devfile.yaml"), filepath.Join(projectDirPath, "devfile.yaml"))
|
||||||
|
|
||||||
args = []string{"push", "--devfile", "devfile.yaml", "--build-command", garbageCommand}
|
args = []string{"push", "--devfile", "devfile.yaml", "--build-command", garbageCommand}
|
||||||
args = useProjectIfAvailable(args, namespace)
|
args = useProjectIfAvailable(args, namespace)
|
||||||
@@ -112,13 +104,13 @@ func ExecWithWrongCustomCommand(projectDirPath, cmpName, namespace string) {
|
|||||||
|
|
||||||
// ExecPushToTestFileChanges executes odo push with and without a file change
|
// ExecPushToTestFileChanges executes odo push with and without a file change
|
||||||
func ExecPushToTestFileChanges(projectDirPath, cmpName, namespace string) {
|
func ExecPushToTestFileChanges(projectDirPath, cmpName, namespace string) {
|
||||||
helper.CmdShouldPass("git", "clone", "https://github.com/che-samples/web-nodejs-sample.git", projectDirPath)
|
|
||||||
helper.Chdir(projectDirPath)
|
|
||||||
|
|
||||||
args := []string{"create", "nodejs", cmpName}
|
args := []string{"create", "nodejs", cmpName}
|
||||||
args = useProjectIfAvailable(args, namespace)
|
args = useProjectIfAvailable(args, namespace)
|
||||||
helper.CmdShouldPass("odo", args...)
|
helper.CmdShouldPass("odo", args...)
|
||||||
|
|
||||||
|
helper.CopyExample(filepath.Join("source", "devfiles", "nodejs", "project"), projectDirPath)
|
||||||
|
helper.CopyExampleDevFile(filepath.Join("source", "devfiles", "nodejs", "devfile.yaml"), filepath.Join(projectDirPath, "devfile.yaml"))
|
||||||
|
|
||||||
args = []string{"push", "--devfile", "devfile.yaml"}
|
args = []string{"push", "--devfile", "devfile.yaml"}
|
||||||
args = useProjectIfAvailable(args, namespace)
|
args = useProjectIfAvailable(args, namespace)
|
||||||
helper.CmdShouldPass("odo", args...)
|
helper.CmdShouldPass("odo", args...)
|
||||||
@@ -133,14 +125,12 @@ func ExecPushToTestFileChanges(projectDirPath, cmpName, namespace string) {
|
|||||||
|
|
||||||
// ExecPushWithForceFlag executes odo push with a force flag
|
// ExecPushWithForceFlag executes odo push with a force flag
|
||||||
func ExecPushWithForceFlag(projectDirPath, cmpName, namespace string) {
|
func ExecPushWithForceFlag(projectDirPath, cmpName, namespace string) {
|
||||||
helper.CmdShouldPass("git", "clone", "https://github.com/che-samples/web-nodejs-sample.git", projectDirPath)
|
|
||||||
helper.Chdir(projectDirPath)
|
|
||||||
|
|
||||||
args := []string{"create", "nodejs", cmpName}
|
args := []string{"create", "nodejs", cmpName}
|
||||||
args = useProjectIfAvailable(args, namespace)
|
args = useProjectIfAvailable(args, namespace)
|
||||||
helper.CmdShouldPass("odo", args...)
|
helper.CmdShouldPass("odo", args...)
|
||||||
|
|
||||||
helper.CopyExample(filepath.Join("source", "devfiles", "nodejs"), projectDirPath)
|
helper.CopyExample(filepath.Join("source", "devfiles", "nodejs", "project"), projectDirPath)
|
||||||
|
helper.CopyExampleDevFile(filepath.Join("source", "devfiles", "nodejs", "devfile.yaml"), filepath.Join(projectDirPath, "devfile.yaml"))
|
||||||
|
|
||||||
args = []string{"push", "--devfile", "devfile.yaml"}
|
args = []string{"push", "--devfile", "devfile.yaml"}
|
||||||
args = useProjectIfAvailable(args, namespace)
|
args = useProjectIfAvailable(args, namespace)
|
||||||
@@ -155,14 +145,12 @@ func ExecPushWithForceFlag(projectDirPath, cmpName, namespace string) {
|
|||||||
|
|
||||||
// ExecPushWithNewFileAndDir executes odo push after creating a new file and dir
|
// ExecPushWithNewFileAndDir executes odo push after creating a new file and dir
|
||||||
func ExecPushWithNewFileAndDir(projectDirPath, cmpName, namespace, newFilePath, newDirPath string) {
|
func ExecPushWithNewFileAndDir(projectDirPath, cmpName, namespace, newFilePath, newDirPath string) {
|
||||||
helper.CmdShouldPass("git", "clone", "https://github.com/che-samples/web-nodejs-sample.git", projectDirPath)
|
|
||||||
helper.Chdir(projectDirPath)
|
|
||||||
|
|
||||||
args := []string{"create", "nodejs", cmpName}
|
args := []string{"create", "nodejs", cmpName}
|
||||||
args = useProjectIfAvailable(args, namespace)
|
args = useProjectIfAvailable(args, namespace)
|
||||||
helper.CmdShouldPass("odo", args...)
|
helper.CmdShouldPass("odo", args...)
|
||||||
|
|
||||||
helper.CopyExample(filepath.Join("source", "devfiles", "nodejs"), projectDirPath)
|
helper.CopyExample(filepath.Join("source", "devfiles", "nodejs", "project"), projectDirPath)
|
||||||
|
helper.CopyExampleDevFile(filepath.Join("source", "devfiles", "nodejs", "devfile.yaml"), filepath.Join(projectDirPath, "devfile.yaml"))
|
||||||
|
|
||||||
// Create a new file that we plan on deleting later...
|
// Create a new file that we plan on deleting later...
|
||||||
if err := helper.CreateFileWithContent(newFilePath, "hello world"); err != nil {
|
if err := helper.CreateFileWithContent(newFilePath, "hello world"); err != nil {
|
||||||
@@ -180,13 +168,11 @@ func ExecPushWithNewFileAndDir(projectDirPath, cmpName, namespace, newFilePath,
|
|||||||
|
|
||||||
// ExecWithRestartAttribute executes odo push with a command attribute restart
|
// ExecWithRestartAttribute executes odo push with a command attribute restart
|
||||||
func ExecWithRestartAttribute(projectDirPath, cmpName, namespace string) {
|
func ExecWithRestartAttribute(projectDirPath, cmpName, namespace string) {
|
||||||
helper.CmdShouldPass("git", "clone", "https://github.com/che-samples/web-nodejs-sample.git", projectDirPath)
|
|
||||||
helper.Chdir(projectDirPath)
|
|
||||||
|
|
||||||
args := []string{"create", "nodejs", cmpName}
|
args := []string{"create", "nodejs", cmpName}
|
||||||
args = useProjectIfAvailable(args, namespace)
|
args = useProjectIfAvailable(args, namespace)
|
||||||
helper.CmdShouldPass("odo", args...)
|
helper.CmdShouldPass("odo", args...)
|
||||||
|
|
||||||
|
helper.CopyExample(filepath.Join("source", "devfiles", "nodejs", "project"), projectDirPath)
|
||||||
helper.CopyExampleDevFile(filepath.Join("source", "devfiles", "nodejs", "devfile-with-restart.yaml"), filepath.Join(projectDirPath, "devfile.yaml"))
|
helper.CopyExampleDevFile(filepath.Join("source", "devfiles", "nodejs", "devfile-with-restart.yaml"), filepath.Join(projectDirPath, "devfile.yaml"))
|
||||||
|
|
||||||
args = []string{"push", "--devfile", "devfile.yaml"}
|
args = []string{"push", "--devfile", "devfile.yaml"}
|
||||||
|
|||||||
Reference in New Issue
Block a user