mirror of
https://github.com/redhat-developer/odo.git
synced 2025-10-19 03:06:19 +03:00
resolved golint errors for variable names and comments incorrectly written
This commit is contained in:
@@ -2,6 +2,7 @@ package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
|
||||
"github.com/posener/complete"
|
||||
"github.com/redhat-developer/odo/pkg/odo/cli"
|
||||
"github.com/redhat-developer/odo/pkg/odo/util/completion"
|
||||
|
||||
@@ -200,7 +200,7 @@ func CreateFromPath(client *occlient.Client, params occlient.CreateArgs) error {
|
||||
labels[componentlabels.ComponentTypeVersion] = imageTag
|
||||
|
||||
// save source path as annotation
|
||||
sourceURL := util.GenFileUrl(params.SourcePath, runtime.GOOS)
|
||||
sourceURL := util.GenFileURL(params.SourcePath, runtime.GOOS)
|
||||
annotations := map[string]string{componentSourceURLAnnotation: sourceURL}
|
||||
annotations[componentSourceTypeAnnotation] = string(params.SourceType)
|
||||
|
||||
@@ -573,7 +573,7 @@ func Update(client *occlient.Client, componentName string, applicationName strin
|
||||
// Steps to update component from git to local or binary
|
||||
|
||||
// Update the sourceURL since it is not a local/binary file.
|
||||
sourceURL := util.GenFileUrl(newSource, runtime.GOOS)
|
||||
sourceURL := util.GenFileURL(newSource, runtime.GOOS)
|
||||
annotations[componentSourceURLAnnotation] = sourceURL
|
||||
|
||||
// Need to delete the old BuildConfig
|
||||
@@ -613,7 +613,7 @@ func Update(client *occlient.Client, componentName string, applicationName strin
|
||||
} else if newSourceType == "local" || newSourceType == "binary" {
|
||||
|
||||
// Update the sourceURL
|
||||
sourceURL := util.GenFileUrl(newSource, runtime.GOOS)
|
||||
sourceURL := util.GenFileURL(newSource, runtime.GOOS)
|
||||
annotations[componentSourceURLAnnotation] = sourceURL
|
||||
|
||||
err = client.UpdateDCAnnotations(namespacedOpenShiftObject, annotations)
|
||||
|
||||
@@ -2,7 +2,6 @@ package component
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/redhat-developer/odo/pkg/util"
|
||||
"io"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@@ -10,6 +9,8 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/redhat-developer/odo/pkg/util"
|
||||
|
||||
"github.com/redhat-developer/odo/pkg/occlient"
|
||||
|
||||
"github.com/fsnotify/fsnotify"
|
||||
@@ -140,7 +141,8 @@ func addRecursiveWatch(watcher *fsnotify.Watcher, path string, ignores []string)
|
||||
return nil
|
||||
}
|
||||
|
||||
var UserRequestedWatchExit = fmt.Errorf("safely exiting from filesystem watch based on user request")
|
||||
// ErrUserRequestedWatchExit is returned when the user stops the watch loop
|
||||
var ErrUserRequestedWatchExit = fmt.Errorf("safely exiting from filesystem watch based on user request")
|
||||
|
||||
// WatchAndPush watches path, if something changes in that path it calls PushLocal
|
||||
// ignores .git/* by default
|
||||
@@ -178,7 +180,7 @@ func WatchAndPush(client *occlient.Client, out io.Writer, parameters WatchParame
|
||||
case extMsg := <-parameters.ExtChan:
|
||||
if extMsg {
|
||||
changeLock.Lock()
|
||||
watchError = UserRequestedWatchExit
|
||||
watchError = ErrUserRequestedWatchExit
|
||||
changeLock.Unlock()
|
||||
}
|
||||
case event := <-watcher.Events:
|
||||
|
||||
@@ -339,7 +339,7 @@ func TestWatchAndPush(t *testing.T) {
|
||||
WatchHandler: mockPushLocal,
|
||||
},
|
||||
)
|
||||
if err != nil && err != UserRequestedWatchExit {
|
||||
if err != nil && err != ErrUserRequestedWatchExit {
|
||||
t.Errorf("error in WatchAndPush %+v", err)
|
||||
}
|
||||
})
|
||||
|
||||
@@ -79,6 +79,8 @@ func getOdoConfigFile() (string, error) {
|
||||
return "", errors.New("unable to get config file")
|
||||
}
|
||||
|
||||
// New gets the configInfo from config file and creates the config file in case it's
|
||||
// not present then it
|
||||
func New() (*ConfigInfo, error) {
|
||||
configFile, err := getOdoConfigFile()
|
||||
if err != nil {
|
||||
@@ -223,7 +225,7 @@ func (c *ConfigInfo) SetActiveComponent(componentName string, applicationName st
|
||||
return nil
|
||||
}
|
||||
|
||||
// Sets the active component as blank of the given project in the configuration file
|
||||
// UnsetActiveComponent sets the active component as blank of the given project in the configuration file
|
||||
func (c *ConfigInfo) UnsetActiveComponent(project string) error {
|
||||
if c.ActiveApplications == nil {
|
||||
c.ActiveApplications = []ApplicationInfo{}
|
||||
@@ -244,7 +246,7 @@ func (c *ConfigInfo) UnsetActiveComponent(project string) error {
|
||||
|
||||
}
|
||||
|
||||
// Sets the active application as blank of the given project in the configuration file
|
||||
// UnsetActiveApplication sets the active application as blank of the given project in the configuration file
|
||||
func (c *ConfigInfo) UnsetActiveApplication(project string) error {
|
||||
if c.ActiveApplications == nil {
|
||||
c.ActiveApplications = []ApplicationInfo{}
|
||||
|
||||
@@ -10,9 +10,9 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
// URL to fetch latest version number
|
||||
// VersionFetchURL is the URL to fetch latest version number
|
||||
VersionFetchURL = "https://raw.githubusercontent.com/redhat-developer/odo/master/build/VERSION"
|
||||
// URL of the installation shell script
|
||||
// InstallScriptURL is URL of the installation shell script
|
||||
InstallScriptURL = "https://raw.githubusercontent.com/redhat-developer/odo/master/scripts/install.sh"
|
||||
)
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
fakeKubeClientset "k8s.io/client-go/kubernetes/fake"
|
||||
)
|
||||
|
||||
// FakeClientSet holds fake ClientSets
|
||||
// FakeClientset holds fake ClientSets
|
||||
// this is returned by FakeNew to access methods of fake client sets
|
||||
type FakeClientset struct {
|
||||
Kubernetes *fakeKubeClientset.Clientset
|
||||
|
||||
@@ -242,7 +242,7 @@ func New(connectionCheck bool) (*Client, error) {
|
||||
return &client, nil
|
||||
}
|
||||
|
||||
// parseImageName parse image reference
|
||||
// ParseImageName parse image reference
|
||||
// returns (imageNamespace, imageName, tag, digest, error)
|
||||
// if image is referenced by tag (name:tag) than digest is ""
|
||||
// if image is referenced by digest (name@digest) than tag is ""
|
||||
@@ -540,7 +540,7 @@ func isTagInImageStream(is imagev1.ImageStream, imageTag string) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// GetImageNS returns the imagestream using image details like imageNS, imageName and imageTag
|
||||
// GetImageStream returns the imagestream using image details like imageNS, imageName and imageTag
|
||||
// imageNS can be empty in which case, this function searches currentNamespace on priority. If
|
||||
// imagestream of required tag not found in current namespace, then searches openshift namespace.
|
||||
// If not found, error out. If imageNS is not empty string, then, the requested imageNS only is searched
|
||||
@@ -592,18 +592,17 @@ func (c *Client) GetImageStream(imageNS string, imageName string, imageTag strin
|
||||
// Required tag not in openshift and current namespaces
|
||||
return nil, fmt.Errorf("image stream %s with tag %s not found in openshift and %s namespaces", imageName, imageTag, currentProjectName)
|
||||
|
||||
} else {
|
||||
}
|
||||
|
||||
// Fetch imagestream from requested namespace
|
||||
imageStream, err = c.imageClient.ImageStreams(imageNS).Get(imageName, metav1.GetOptions{})
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(
|
||||
err, "no match found for %s in namespace %s", imageName, imageNS,
|
||||
)
|
||||
}
|
||||
if !isTagInImageStream(*imageStream, imageTag) {
|
||||
return nil, fmt.Errorf("image stream %s with tag %s not found in %s namespaces", imageName, imageTag, currentProjectName)
|
||||
}
|
||||
// Fetch imagestream from requested namespace
|
||||
imageStream, err = c.imageClient.ImageStreams(imageNS).Get(imageName, metav1.GetOptions{})
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(
|
||||
err, "no match found for %s in namespace %s", imageName, imageNS,
|
||||
)
|
||||
}
|
||||
if !isTagInImageStream(*imageStream, imageTag) {
|
||||
return nil, fmt.Errorf("image stream %s with tag %s not found in %s namespaces", imageName, imageTag, currentProjectName)
|
||||
}
|
||||
|
||||
return imageStream, nil
|
||||
@@ -641,9 +640,10 @@ func (c *Client) GetImageStreamImage(imageStream *imagev1.ImageStream, imageTag
|
||||
return nil, errors.Wrapf(err, "unable to find ImageStreamImage with %s digest", imageStreamImageName)
|
||||
}
|
||||
return imageStreamImage, nil
|
||||
} else {
|
||||
return nil, fmt.Errorf("unable to find tag %s for image %s", imageTag, imageName)
|
||||
}
|
||||
|
||||
return nil, fmt.Errorf("unable to find tag %s for image %s", imageTag, imageName)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1636,7 +1636,7 @@ func (c *Client) FollowBuildLog(buildName string, stdout io.Writer) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Display DeploymentConfig log to stdout
|
||||
// DisplayDeploymentConfigLog logs the deployment config to stdout
|
||||
func (c *Client) DisplayDeploymentConfigLog(deploymentConfigName string, followLog bool, stdout io.Writer) error {
|
||||
|
||||
// Set standard log options
|
||||
@@ -2737,9 +2737,9 @@ func (c *Client) AddEnvironmentVariablesToDeploymentConfig(envs []corev1.EnvVar,
|
||||
return nil
|
||||
}
|
||||
|
||||
// serverInfo contains the fields that contain the server's information like
|
||||
// ServerInfo contains the fields that contain the server's information like
|
||||
// address, OpenShift and Kubernetes versions
|
||||
type serverInfo struct {
|
||||
type ServerInfo struct {
|
||||
Address string
|
||||
OpenShiftVersion string
|
||||
KubernetesVersion string
|
||||
@@ -2747,8 +2747,8 @@ type serverInfo struct {
|
||||
|
||||
// GetServerVersion will fetch the Server Host, OpenShift and Kubernetes Version
|
||||
// It will be shown on the execution of odo version command
|
||||
func (c *Client) GetServerVersion() (*serverInfo, error) {
|
||||
var info serverInfo
|
||||
func (c *Client) GetServerVersion() (*ServerInfo, error) {
|
||||
var info ServerInfo
|
||||
|
||||
// This will fetch the information about Server Address
|
||||
config, err := c.KubeConfig.ClientConfig()
|
||||
@@ -2979,10 +2979,10 @@ func getInputEnvVarsFromStrings(envVars []string) ([]corev1.EnvVar, error) {
|
||||
_, ok := keys[splits[0]]
|
||||
if ok {
|
||||
return nil, errors.Errorf("multiple values found for VariableName: %s", splits[0])
|
||||
} else {
|
||||
keys[splits[0]] = 1
|
||||
}
|
||||
|
||||
keys[splits[0]] = 1
|
||||
|
||||
inputEnvVars = append(inputEnvVars, corev1.EnvVar{
|
||||
Name: splits[0],
|
||||
Value: splits[1],
|
||||
|
||||
@@ -3,6 +3,7 @@ package cli
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
|
||||
"github.com/golang/glog"
|
||||
"github.com/redhat-developer/odo/pkg/config"
|
||||
"github.com/redhat-developer/odo/pkg/odo/cli/application"
|
||||
@@ -139,7 +140,7 @@ func init() {
|
||||
project.NewCmdProject(),
|
||||
service.NewCmdService(),
|
||||
storage.NewCmdStorage(),
|
||||
url.NewCmdUrl(),
|
||||
url.NewCmdURL(),
|
||||
utils.NewCmdUtils(),
|
||||
version.NewCmdVersion(),
|
||||
)
|
||||
|
||||
@@ -2,12 +2,13 @@ package component
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/redhat-developer/odo/pkg/odo/genericclioptions"
|
||||
odoutil "github.com/redhat-developer/odo/pkg/odo/util"
|
||||
"net/url"
|
||||
"os"
|
||||
"runtime"
|
||||
|
||||
"github.com/redhat-developer/odo/pkg/odo/genericclioptions"
|
||||
odoutil "github.com/redhat-developer/odo/pkg/odo/util"
|
||||
|
||||
"github.com/fatih/color"
|
||||
"github.com/redhat-developer/odo/pkg/component"
|
||||
"github.com/redhat-developer/odo/pkg/util"
|
||||
@@ -57,7 +58,7 @@ var pushCmd = &cobra.Command{
|
||||
fmt.Printf("Unable to push local directory:%s to component %s that uses binary %s.\n", componentLocal, componentName, sourcePath)
|
||||
os.Exit(1)
|
||||
}
|
||||
sourcePath = util.GenFileUrl(componentLocal, runtime.GOOS)
|
||||
sourcePath = util.GenFileURL(componentLocal, runtime.GOOS)
|
||||
}
|
||||
|
||||
u, err := url.Parse(sourcePath)
|
||||
|
||||
@@ -2,11 +2,12 @@ package url
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/redhat-developer/odo/pkg/odo/genericclioptions"
|
||||
"github.com/redhat-developer/odo/pkg/odo/util/completion"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/redhat-developer/odo/pkg/odo/genericclioptions"
|
||||
"github.com/redhat-developer/odo/pkg/odo/util/completion"
|
||||
|
||||
odoutil "github.com/redhat-developer/odo/pkg/odo/util"
|
||||
"github.com/redhat-developer/odo/pkg/util"
|
||||
|
||||
@@ -82,7 +83,7 @@ The created URL can be used to access the specified component from outside the O
|
||||
urlRoute, err := url.Create(client, urlName, urlPort, componentName, applicationName)
|
||||
odoutil.CheckError(err, "")
|
||||
|
||||
urlCreated := url.GetUrlString(*urlRoute)
|
||||
urlCreated := url.GetURLString(*urlRoute)
|
||||
fmt.Printf("URL created for component: %v\n\n"+
|
||||
"%v - %v\n", componentName, urlRoute.Name, urlCreated)
|
||||
|
||||
@@ -164,14 +165,14 @@ var urlListCmd = &cobra.Command{
|
||||
fmt.Fprintln(tabWriterURL, "NAME", "\t", "URL", "\t", "PORT")
|
||||
|
||||
for _, u := range urls {
|
||||
fmt.Fprintln(tabWriterURL, u.Name, "\t", url.GetUrlString(u), "\t", u.Port)
|
||||
fmt.Fprintln(tabWriterURL, u.Name, "\t", url.GetURLString(u), "\t", u.Port)
|
||||
}
|
||||
tabWriterURL.Flush()
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
func NewCmdUrl() *cobra.Command {
|
||||
func NewCmdURL() *cobra.Command {
|
||||
urlCreateCmd.Flags().IntVarP(&urlPort, "port", "", -1, "port number for the url of the component, required in case of components which expose more than one service port")
|
||||
urlCreateCmd.Flags().BoolVar(&urlOpenFlag, "open", false, "open the created link with your default browser")
|
||||
|
||||
|
||||
@@ -121,9 +121,10 @@ func SimulateFileModifications(basePath string, fileModification FileProperties)
|
||||
return "", err
|
||||
}
|
||||
return filepath.Join(basePath, fileModification.FilePath), nil
|
||||
} else {
|
||||
return "", fmt.Errorf("Append not supported for file of type %v", fileModification.FileType)
|
||||
}
|
||||
|
||||
return "", fmt.Errorf("Append not supported for file of type %v", fileModification.FileType)
|
||||
|
||||
default:
|
||||
return "", fmt.Errorf("Unsupported file operation %s", fileModification.ModificationType)
|
||||
}
|
||||
|
||||
@@ -4,14 +4,14 @@ import (
|
||||
componentlabels "github.com/redhat-developer/odo/pkg/component/labels"
|
||||
)
|
||||
|
||||
// UrlLabel is the label key that is applied to all url resources
|
||||
// URLLabel is the label key that is applied to all url resources
|
||||
// that are created
|
||||
const UrlLabel = "app.kubernetes.io/url-name"
|
||||
const URLLabel = "app.kubernetes.io/url-name"
|
||||
|
||||
// GetLabels gets the labels to be applied to the given url besides the
|
||||
// component labels and application labels.
|
||||
func GetLabels(urlName string, componentName string, applicationName string, additional bool) map[string]string {
|
||||
labels := componentlabels.GetLabels(componentName, applicationName, additional)
|
||||
labels[UrlLabel] = urlName
|
||||
labels[URLLabel] = urlName
|
||||
return labels
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ func TestGetLabels(t *testing.T) {
|
||||
want: map[string]string{
|
||||
applabels.ApplicationLabel: "applicationame",
|
||||
componentlabels.ComponentLabel: "componentname",
|
||||
UrlLabel: "urlname",
|
||||
URLLabel: "urlname",
|
||||
},
|
||||
}, {
|
||||
name: "no storage name",
|
||||
@@ -44,7 +44,7 @@ func TestGetLabels(t *testing.T) {
|
||||
want: map[string]string{
|
||||
applabels.ApplicationLabel: "applicationame",
|
||||
componentlabels.ComponentLabel: "componentname",
|
||||
UrlLabel: "",
|
||||
URLLabel: "",
|
||||
},
|
||||
}, {
|
||||
name: "everything with additional",
|
||||
@@ -58,7 +58,7 @@ func TestGetLabels(t *testing.T) {
|
||||
applabels.ApplicationLabel: "applicationame",
|
||||
applabels.AdditionalApplicationLabels[0]: "applicationame",
|
||||
componentlabels.ComponentLabel: "componentname",
|
||||
UrlLabel: "urlname",
|
||||
URLLabel: "urlname",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ func Create(client *occlient.Client, urlName string, portNumber int, componentNa
|
||||
return nil, errors.Wrap(err, "unable to create route")
|
||||
}
|
||||
return &URL{
|
||||
Name: route.Labels[urlLabels.UrlLabel],
|
||||
Name: route.Labels[urlLabels.URLLabel],
|
||||
URL: route.Spec.Host,
|
||||
Protocol: getProtocol(*route),
|
||||
Port: route.Spec.Port.TargetPort.IntValue(),
|
||||
@@ -111,7 +111,7 @@ func List(client *occlient.Client, componentName string, applicationName string)
|
||||
var urls []URL
|
||||
for _, r := range routes {
|
||||
urls = append(urls, URL{
|
||||
Name: r.Labels[urlLabels.UrlLabel],
|
||||
Name: r.Labels[urlLabels.URLLabel],
|
||||
URL: r.Spec.Host,
|
||||
Protocol: getProtocol(r),
|
||||
Port: r.Spec.Port.TargetPort.IntValue(),
|
||||
@@ -124,12 +124,12 @@ func List(client *occlient.Client, componentName string, applicationName string)
|
||||
func getProtocol(route routev1.Route) string {
|
||||
if route.Spec.TLS != nil {
|
||||
return "https"
|
||||
} else {
|
||||
return "http"
|
||||
}
|
||||
return "http"
|
||||
|
||||
}
|
||||
|
||||
func GetUrlString(url URL) string {
|
||||
func GetURLString(url URL) string {
|
||||
return url.Protocol + "://" + url.URL
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"fmt"
|
||||
|
||||
routev1 "github.com/openshift/api/route/v1"
|
||||
applabels "github.com/redhat-developer/odo/pkg/application/labels"
|
||||
componentlabels "github.com/redhat-developer/odo/pkg/component/labels"
|
||||
@@ -454,7 +455,7 @@ func TestExists(t *testing.T) {
|
||||
Labels: map[string]string{
|
||||
applabels.ApplicationLabel: "app",
|
||||
componentlabels.ComponentLabel: "nodejs",
|
||||
labels.UrlLabel: "nodejs",
|
||||
labels.URLLabel: "nodejs",
|
||||
},
|
||||
},
|
||||
Spec: routev1.RouteSpec{
|
||||
@@ -473,7 +474,7 @@ func TestExists(t *testing.T) {
|
||||
Labels: map[string]string{
|
||||
applabels.ApplicationLabel: "app",
|
||||
componentlabels.ComponentLabel: "wildfly",
|
||||
labels.UrlLabel: "wildfly",
|
||||
labels.URLLabel: "wildfly",
|
||||
},
|
||||
},
|
||||
Spec: routev1.RouteSpec{
|
||||
@@ -505,7 +506,7 @@ func TestExists(t *testing.T) {
|
||||
Labels: map[string]string{
|
||||
applabels.ApplicationLabel: "app",
|
||||
componentlabels.ComponentLabel: "nodejs",
|
||||
labels.UrlLabel: "nodejs",
|
||||
labels.URLLabel: "nodejs",
|
||||
},
|
||||
},
|
||||
Spec: routev1.RouteSpec{
|
||||
@@ -524,7 +525,7 @@ func TestExists(t *testing.T) {
|
||||
Labels: map[string]string{
|
||||
applabels.ApplicationLabel: "app",
|
||||
componentlabels.ComponentLabel: "wildfly",
|
||||
labels.UrlLabel: "wildfly",
|
||||
labels.URLLabel: "wildfly",
|
||||
},
|
||||
},
|
||||
Spec: routev1.RouteSpec{
|
||||
|
||||
@@ -132,7 +132,7 @@ func ReadFilePath(u *url.URL, os string) string {
|
||||
}
|
||||
|
||||
// Converts file path on windows to /C:/path/to/file to work in URL
|
||||
func GenFileUrl(location string, os string) string {
|
||||
func GenFileURL(location string, os string) string {
|
||||
urlPath := location
|
||||
if os == WIN {
|
||||
urlPath = "/" + strings.Replace(location, "\\", "/", -1)
|
||||
|
||||
@@ -208,7 +208,7 @@ func TestFilePathConversion(t *testing.T) {
|
||||
t.Errorf(fmt.Sprintf("Error when parsing url '%s'", tt.url))
|
||||
}
|
||||
} else if tt.direction == "path to url" {
|
||||
url := GenFileUrl(tt.path, tt.os)
|
||||
url := GenFileURL(tt.path, tt.os)
|
||||
if url != tt.url {
|
||||
t.Errorf(fmt.Sprintf("Expected a path to be '%s' converted to an url '%s", tt.path, tt.url))
|
||||
}
|
||||
|
||||
@@ -34,8 +34,8 @@ func SourceTest(appTestName string, sourceType string, source string) {
|
||||
var _ = Describe("odoCmpE2e", func() {
|
||||
const bootStrapSupervisorURI = "https://github.com/kadel/bootstrap-supervisored-s2i"
|
||||
const initContainerName = "copy-files-to-volume"
|
||||
const wildflyUri1 = "https://github.com/marekjelen/katacoda-odo-backend"
|
||||
const wildflyUri2 = "https://github.com/mik-dass/katacoda-odo-backend"
|
||||
const wildflyURI1 = "https://github.com/marekjelen/katacoda-odo-backend"
|
||||
const wildflyURI2 = "https://github.com/mik-dass/katacoda-odo-backend"
|
||||
const appRootVolumeName = "-testing-s2idata"
|
||||
|
||||
var t = strconv.FormatInt(time.Now().Unix(), 10)
|
||||
@@ -67,16 +67,16 @@ var _ = Describe("odoCmpE2e", func() {
|
||||
)
|
||||
Expect(getMemoryRequest).To(ContainSubstring("100Mi"))
|
||||
|
||||
getCpuLimit := runCmd("oc get dc cmp-git-" +
|
||||
getCPULimit := runCmd("oc get dc cmp-git-" +
|
||||
appTestName +
|
||||
" -o go-template='{{range .spec.template.spec.containers}}{{.resources.limits.cpu}}{{end}}'",
|
||||
)
|
||||
Expect(getCpuLimit).To(ContainSubstring("2"))
|
||||
getCpuRequest := runCmd("oc get dc cmp-git-" +
|
||||
Expect(getCPULimit).To(ContainSubstring("2"))
|
||||
getCPURequest := runCmd("oc get dc cmp-git-" +
|
||||
appTestName +
|
||||
" -o go-template='{{range .spec.template.spec.containers}}{{.resources.requests.cpu}}{{end}}'",
|
||||
)
|
||||
Expect(getCpuRequest).To(ContainSubstring("100m"))
|
||||
Expect(getCPURequest).To(ContainSubstring("100m"))
|
||||
})
|
||||
|
||||
It("should list the component", func() {
|
||||
@@ -160,7 +160,7 @@ var _ = Describe("odoCmpE2e", func() {
|
||||
})
|
||||
|
||||
It("should update component from binary to local", func() {
|
||||
runCmd("git clone " + wildflyUri1 + " " +
|
||||
runCmd("git clone " + wildflyURI1 + " " +
|
||||
tmpDir + "/katacoda-odo-backend-1")
|
||||
|
||||
waitForDCOfComponentToRolloutCompletely("wildfly")
|
||||
@@ -242,7 +242,7 @@ var _ = Describe("odoCmpE2e", func() {
|
||||
})
|
||||
|
||||
It("should update component from local to local", func() {
|
||||
runCmd("git clone " + wildflyUri2 + " " +
|
||||
runCmd("git clone " + wildflyURI2 + " " +
|
||||
tmpDir + "/katacoda-odo-backend-2")
|
||||
|
||||
waitForDCOfComponentToRolloutCompletely("wildfly")
|
||||
@@ -271,11 +271,11 @@ var _ = Describe("odoCmpE2e", func() {
|
||||
|
||||
It("should update component from local to git", func() {
|
||||
waitForDCOfComponentToRolloutCompletely("wildfly")
|
||||
runCmd("odo update wildfly --git " + wildflyUri1)
|
||||
runCmd("odo update wildfly --git " + wildflyURI1)
|
||||
|
||||
// checking bc for updates
|
||||
getBc := runCmd("oc get bc wildfly-" + appTestName + " -o go-template={{.spec.source.git.uri}}")
|
||||
Expect(getBc).To(Equal(wildflyUri1))
|
||||
Expect(getBc).To(Equal(wildflyURI1))
|
||||
|
||||
// checking for init containers
|
||||
getDc := runCmd("oc get dc wildfly-" + appTestName + " -o go-template='" +
|
||||
@@ -295,15 +295,15 @@ var _ = Describe("odoCmpE2e", func() {
|
||||
"{{.name}}{{end}}{{end}}'")
|
||||
Expect(getDc).NotTo(ContainSubstring("wildfly" + appRootVolumeName))
|
||||
|
||||
SourceTest(appTestName, "git", wildflyUri1)
|
||||
SourceTest(appTestName, "git", wildflyURI1)
|
||||
})
|
||||
It("should update component from git to git", func() {
|
||||
waitForDCOfComponentToRolloutCompletely("wildfly")
|
||||
runCmd("odo update wildfly --git " + wildflyUri2)
|
||||
runCmd("odo update wildfly --git " + wildflyURI2)
|
||||
|
||||
// checking bc for updates
|
||||
getBc := runCmd("oc get bc wildfly-" + appTestName + " -o go-template={{.spec.source.git.uri}}")
|
||||
Expect(getBc).To(Equal(wildflyUri2))
|
||||
Expect(getBc).To(Equal(wildflyURI2))
|
||||
|
||||
// checking for init containers
|
||||
getDc := runCmd("oc get dc wildfly-" + appTestName + " -o go-template='" +
|
||||
@@ -323,13 +323,13 @@ var _ = Describe("odoCmpE2e", func() {
|
||||
"{{.name}}{{end}}{{end}}'")
|
||||
Expect(getDc).NotTo(ContainSubstring("wildfly" + appRootVolumeName))
|
||||
|
||||
SourceTest(appTestName, "git", wildflyUri2)
|
||||
SourceTest(appTestName, "git", wildflyURI2)
|
||||
})
|
||||
|
||||
// This is expected to be removed at the time of fixing https://github.com/redhat-developer/odo/issues/1008
|
||||
It("should create a wildfly git component", func() {
|
||||
runCmd("odo delete wildfly -f")
|
||||
runCmd("odo create wildfly wildfly --git " + wildflyUri1)
|
||||
runCmd("odo create wildfly wildfly --git " + wildflyURI1)
|
||||
})
|
||||
|
||||
It("should update component from git to local", func() {
|
||||
@@ -384,7 +384,7 @@ var _ = Describe("odoCmpE2e", func() {
|
||||
|
||||
It("should create a wildfly git component", func() {
|
||||
runCmd("odo delete wildfly -f")
|
||||
runCmd("odo create wildfly wildfly --git " + wildflyUri1)
|
||||
runCmd("odo create wildfly wildfly --git " + wildflyURI1)
|
||||
})
|
||||
|
||||
It("should update component from git to binary", func() {
|
||||
@@ -414,11 +414,11 @@ var _ = Describe("odoCmpE2e", func() {
|
||||
|
||||
It("should update component from binary to git", func() {
|
||||
waitForDCOfComponentToRolloutCompletely("wildfly")
|
||||
runCmd("odo update wildfly --git " + wildflyUri1)
|
||||
runCmd("odo update wildfly --git " + wildflyURI1)
|
||||
|
||||
// checking bc for updates
|
||||
getBc := runCmd("oc get bc wildfly-" + appTestName + " -o go-template={{.spec.source.git.uri}}")
|
||||
Expect(getBc).To(Equal(wildflyUri1))
|
||||
Expect(getBc).To(Equal(wildflyURI1))
|
||||
|
||||
// checking for init containers
|
||||
getDc := runCmd("oc get dc wildfly-" + appTestName + " -o go-template='" +
|
||||
@@ -438,7 +438,7 @@ var _ = Describe("odoCmpE2e", func() {
|
||||
"{{.name}}{{end}}{{end}}'")
|
||||
Expect(getDc).NotTo(ContainSubstring("wildfly" + appRootVolumeName))
|
||||
|
||||
SourceTest(appTestName, "git", wildflyUri1)
|
||||
SourceTest(appTestName, "git", wildflyURI1)
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
@@ -308,8 +308,8 @@ var _ = Describe("odoe2e", func() {
|
||||
Context("using odo url", func() {
|
||||
It("should create route without url name provided", func() {
|
||||
runCmd("odo component set nodejs")
|
||||
getUrlOut := runCmd("odo url create")
|
||||
Expect(getUrlOut).To(ContainSubstring("nodejs-" + appTestName + "-" + projName))
|
||||
getURLOut := runCmd("odo url create")
|
||||
Expect(getURLOut).To(ContainSubstring("nodejs-" + appTestName + "-" + projName))
|
||||
|
||||
// check the port number of the created URL
|
||||
port := runCmd("oc get route nodejs-" + appTestName + " -o go-template='{{index .spec.port.targetPort}}'")
|
||||
@@ -321,8 +321,8 @@ var _ = Describe("odoe2e", func() {
|
||||
|
||||
It("should create route without port in case of single service port component", func() {
|
||||
runCmd("odo component set nodejs")
|
||||
getUrlOut := runCmd("odo url create nodejs")
|
||||
Expect(getUrlOut).To(ContainSubstring("nodejs-" + appTestName + "-" + projName))
|
||||
getURLOut := runCmd("odo url create nodejs")
|
||||
Expect(getURLOut).To(ContainSubstring("nodejs-" + appTestName + "-" + projName))
|
||||
|
||||
// check the port number of the created URL
|
||||
port := runCmd("oc get route nodejs-" + appTestName + " -o go-template='{{index .spec.port.targetPort}}'")
|
||||
@@ -343,8 +343,8 @@ var _ = Describe("odoe2e", func() {
|
||||
|
||||
It("should create route with required port", func() {
|
||||
runCmd("odo create httpd httpd-test --git https://github.com/openshift/httpd-ex.git")
|
||||
getUrlOut := runCmd("odo url create example-url --port 8443")
|
||||
Expect(getUrlOut).To(ContainSubstring("example-url-" + appTestName + "-" + projName))
|
||||
getURLOut := runCmd("odo url create example-url --port 8443")
|
||||
Expect(getURLOut).To(ContainSubstring("example-url-" + appTestName + "-" + projName))
|
||||
|
||||
// check the port number of the created URL
|
||||
port := runCmd("oc get route example-url-" + appTestName + " -o go-template='{{index .spec.port.targetPort}}'")
|
||||
@@ -597,8 +597,8 @@ var _ = Describe("updateE2e", func() {
|
||||
|
||||
const bootStrapSupervisorURI = "https://github.com/kadel/bootstrap-supervisored-s2i"
|
||||
const initContainerName = "copy-files-to-volume"
|
||||
const wildflyUri1 = "https://github.com/marekjelen/katacoda-odo-backend"
|
||||
const wildflyUri2 = "https://github.com/mik-dass/katacoda-odo-backend"
|
||||
const wildflyURI1 = "https://github.com/marekjelen/katacoda-odo-backend"
|
||||
const wildflyURI2 = "https://github.com/mik-dass/katacoda-odo-backend"
|
||||
const appRootVolumeName = "-testing-s2idata"
|
||||
|
||||
tmpDir, err := ioutil.TempDir("", "odo")
|
||||
@@ -675,7 +675,7 @@ var _ = Describe("updateE2e", func() {
|
||||
})
|
||||
|
||||
It("should update component from binary to local", func() {
|
||||
runCmd("git clone " + wildflyUri1 + " " +
|
||||
runCmd("git clone " + wildflyURI1 + " " +
|
||||
tmpDir + "/katacoda-odo-backend-1")
|
||||
|
||||
waitForDCOfComponentToRolloutCompletely("wildfly")
|
||||
@@ -708,7 +708,7 @@ var _ = Describe("updateE2e", func() {
|
||||
})
|
||||
|
||||
It("should update component from local to local", func() {
|
||||
runCmd("git clone " + wildflyUri2 + " " +
|
||||
runCmd("git clone " + wildflyURI2 + " " +
|
||||
tmpDir + "/katacoda-odo-backend-2")
|
||||
|
||||
waitForDCOfComponentToRolloutCompletely("wildfly")
|
||||
@@ -742,11 +742,11 @@ var _ = Describe("updateE2e", func() {
|
||||
|
||||
It("should update component from local to git", func() {
|
||||
waitForDCOfComponentToRolloutCompletely("wildfly")
|
||||
runCmd("odo update wildfly --git " + wildflyUri1)
|
||||
runCmd("odo update wildfly --git " + wildflyURI1)
|
||||
|
||||
// checking bc for updates
|
||||
getBc := runCmd("oc get bc wildfly-" + appTestName + " -o go-template={{.spec.source.git.uri}}")
|
||||
Expect(getBc).To(Equal(wildflyUri1))
|
||||
Expect(getBc).To(Equal(wildflyURI1))
|
||||
|
||||
// checking for init containers
|
||||
getDc := runCmd("oc get dc wildfly-" + appTestName + " -o go-template='" +
|
||||
@@ -766,17 +766,17 @@ var _ = Describe("updateE2e", func() {
|
||||
"{{.name}}{{end}}{{end}}'")
|
||||
Expect(getDc).NotTo(ContainSubstring("wildfly" + appRootVolumeName))
|
||||
|
||||
SourceTest(appTestName, "git", wildflyUri1)
|
||||
SourceTest(appTestName, "git", wildflyURI1)
|
||||
EnvVarTest("wildfly-"+appTestName, "git", "keyvaluekey1value1")
|
||||
})
|
||||
|
||||
It("should update component from git to git", func() {
|
||||
waitForDCOfComponentToRolloutCompletely("wildfly")
|
||||
runCmd("odo update wildfly --git " + wildflyUri2)
|
||||
runCmd("odo update wildfly --git " + wildflyURI2)
|
||||
|
||||
// checking bc for updates
|
||||
getBc := runCmd("oc get bc wildfly-" + appTestName + " -o go-template={{.spec.source.git.uri}}")
|
||||
Expect(getBc).To(Equal(wildflyUri2))
|
||||
Expect(getBc).To(Equal(wildflyURI2))
|
||||
|
||||
// checking for init containers
|
||||
getDc := runCmd("oc get dc wildfly-" + appTestName + " -o go-template='" +
|
||||
@@ -796,7 +796,7 @@ var _ = Describe("updateE2e", func() {
|
||||
"{{.name}}{{end}}{{end}}'")
|
||||
Expect(getDc).NotTo(ContainSubstring("wildfly" + appRootVolumeName))
|
||||
|
||||
SourceTest(appTestName, "git", wildflyUri2)
|
||||
SourceTest(appTestName, "git", wildflyURI2)
|
||||
EnvVarTest("wildfly-"+appTestName, "git", "keyvaluekey1value1")
|
||||
})
|
||||
|
||||
@@ -832,11 +832,11 @@ var _ = Describe("updateE2e", func() {
|
||||
|
||||
It("should update component from binary to git", func() {
|
||||
waitForDCOfComponentToRolloutCompletely("wildfly")
|
||||
runCmd("odo update wildfly --git " + wildflyUri1)
|
||||
runCmd("odo update wildfly --git " + wildflyURI1)
|
||||
|
||||
// checking bc for updates
|
||||
getBc := runCmd("oc get bc wildfly-" + appTestName + " -o go-template={{.spec.source.git.uri}}")
|
||||
Expect(getBc).To(Equal(wildflyUri1))
|
||||
Expect(getBc).To(Equal(wildflyURI1))
|
||||
|
||||
// checking for init containers
|
||||
getDc := runCmd("oc get dc wildfly-" + appTestName + " -o go-template='" +
|
||||
@@ -856,7 +856,7 @@ var _ = Describe("updateE2e", func() {
|
||||
"{{.name}}{{end}}{{end}}'")
|
||||
Expect(getDc).NotTo(ContainSubstring("wildfly" + appRootVolumeName))
|
||||
|
||||
SourceTest(appTestName, "git", wildflyUri1)
|
||||
SourceTest(appTestName, "git", wildflyURI1)
|
||||
EnvVarTest("wildfly-"+appTestName, "git", "keyvaluekey1value1")
|
||||
})
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace SampleApp
|
||||
options.NoDelay = true;
|
||||
options.UseConnectionLogging();
|
||||
})
|
||||
.UseUrls("http://0.0.0.0:8080")
|
||||
.UseURLs("http://0.0.0.0:8080")
|
||||
.UseContentRoot(Directory.GetCurrentDirectory())
|
||||
.UseStartup<Startup>()
|
||||
.Build();
|
||||
|
||||
Reference in New Issue
Block a user