mirror of
				https://github.com/redhat-developer/odo.git
				synced 2025-10-19 03:06:19 +03:00 
			
		
		
		
	resolved some incorrect comments (#3473)
* resolved some incorrect comments * resolved all comments * resolved a typo
This commit is contained in:
		| @@ -2,11 +2,12 @@ package debug | ||||
|  | ||||
| import ( | ||||
| 	"encoding/json" | ||||
| 	"github.com/openshift/odo/pkg/util" | ||||
| 	"os" | ||||
| 	"reflect" | ||||
| 	"testing" | ||||
|  | ||||
| 	"github.com/openshift/odo/pkg/util" | ||||
|  | ||||
| 	"github.com/openshift/odo/pkg/testingutil" | ||||
| 	"github.com/openshift/odo/pkg/testingutil/filesystem" | ||||
| 	v1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||||
| @@ -295,7 +296,7 @@ func Test_getDebugInfo(t *testing.T) { | ||||
| 	for _, tt := range tests { | ||||
| 		t.Run(tt.name, func(t *testing.T) { | ||||
|  | ||||
| 			freePort, err := util.HttpGetFreePort() | ||||
| 			freePort, err := util.HTTPGetFreePort() | ||||
| 			if err != nil { | ||||
| 				t.Errorf("error occured while getting a free port, cause: %v", err) | ||||
| 			} | ||||
|   | ||||
| @@ -95,7 +95,7 @@ type Composite struct { | ||||
| 	Parallel bool `json:"parallel,omitempty"` | ||||
| } | ||||
|  | ||||
| // Configuration | ||||
| // Configuration holds configuration for an endpoint | ||||
| type Configuration struct { | ||||
| 	CookiesAuthEnabled bool   `json:"cookiesAuthEnabled,omitempty"` | ||||
| 	Discoverable       bool   `json:"discoverable,omitempty"` | ||||
| @@ -136,7 +136,7 @@ type Container struct { | ||||
| 	VolumeMounts []*VolumeMount `json:"volumeMounts,omitempty"` | ||||
| } | ||||
|  | ||||
| // Endpoint | ||||
| // Endpoint holds information about how an application is exposed | ||||
| type Endpoint struct { | ||||
| 	Attributes    map[string]string `json:"attributes,omitempty"` | ||||
| 	Configuration *Configuration    `json:"configuration,omitempty"` | ||||
| @@ -144,7 +144,7 @@ type Endpoint struct { | ||||
| 	TargetPort    int32             `json:"targetPort"` | ||||
| } | ||||
|  | ||||
| // Env | ||||
| // Env is the key value pair representing an Environment variable | ||||
| type Env struct { | ||||
| 	Name  string `json:"name"` | ||||
| 	Value string `json:"value"` | ||||
| @@ -322,7 +322,7 @@ type Plugin struct { | ||||
| 	Uri string `json:"uri,omitempty"` | ||||
| } | ||||
|  | ||||
| // ProjectsItems | ||||
| // Project holds details of a starter project that can be downloaded by the user | ||||
| type Project struct { | ||||
|  | ||||
| 	// Path relative to the root of the projects to which this project should be cloned into. This is a unix-style relative path (i.e. uses forward slashes). The path is invalid if it is absolute or tries to escape the project root through the usage of '..'. If not specified, defaults to the project name. | ||||
|   | ||||
| @@ -14,7 +14,7 @@ const ( | ||||
| 	CustomComponentType     DevfileComponentType = "Custom" | ||||
| ) | ||||
|  | ||||
| // CommandGroupType describes the kind of command group. | ||||
| // DevfileCommandGroupType describes the kind of command group. | ||||
| // +kubebuilder:validation:Enum=build;run;test;debug | ||||
| type DevfileCommandGroupType string | ||||
|  | ||||
| @@ -305,7 +305,7 @@ type Volume struct { | ||||
| 	Size string `json:"size,omitempty"` | ||||
| } | ||||
|  | ||||
| // VolumeMountsItems Volume that should be mounted to a component container | ||||
| // VolumeMount describes a path where a volume should be mounted to a component container | ||||
| type VolumeMount struct { | ||||
|  | ||||
| 	// The volume mount name is the name of an existing `Volume` component. If no corresponding `Volume` component exist it is implicitly added. If several containers mount the same volume name then they will reuse the same volume and will be able to access to the same files. | ||||
|   | ||||
| @@ -160,7 +160,7 @@ func (c *Client) DeleteDeployment(labels map[string]string) error { | ||||
| 	return c.KubeClient.AppsV1().Deployments(c.Namespace).DeleteCollection(&metav1.DeleteOptions{}, metav1.ListOptions{LabelSelector: selector}) | ||||
| } | ||||
|  | ||||
| // CreateDynamicDeployment creates a dynamic deployment for Operator backed service | ||||
| // CreateDynamicResource creates a dynamic custom resource | ||||
| func (c *Client) CreateDynamicResource(exampleCustomResource map[string]interface{}, group, version, resource string) error { | ||||
| 	deploymentRes := schema.GroupVersionResource{Group: group, Version: version, Resource: resource} | ||||
|  | ||||
|   | ||||
| @@ -2,17 +2,18 @@ package debug | ||||
|  | ||||
| import ( | ||||
| 	"fmt" | ||||
| 	"net" | ||||
| 	"os" | ||||
| 	"os/signal" | ||||
| 	"strconv" | ||||
| 	"syscall" | ||||
|  | ||||
| 	"github.com/openshift/odo/pkg/config" | ||||
| 	"github.com/openshift/odo/pkg/debug" | ||||
| 	"github.com/openshift/odo/pkg/log" | ||||
| 	"github.com/openshift/odo/pkg/odo/genericclioptions" | ||||
| 	"github.com/openshift/odo/pkg/odo/util/experimental" | ||||
| 	"github.com/openshift/odo/pkg/util" | ||||
| 	"net" | ||||
| 	"os" | ||||
| 	"os/signal" | ||||
| 	"strconv" | ||||
| 	"syscall" | ||||
|  | ||||
| 	"github.com/spf13/cobra" | ||||
|  | ||||
| @@ -109,7 +110,7 @@ func (o *PortForwardOptions) Complete(name string, cmd *cobra.Command, args []st | ||||
| 		} | ||||
| 		// else display a error message and auto select a new free port | ||||
| 		log.Errorf("the local debug port %v is not free, cause: %v", o.localPort, err) | ||||
| 		o.localPort, err = util.HttpGetFreePort() | ||||
| 		o.localPort, err = util.HTTPGetFreePort() | ||||
| 		if err != nil { | ||||
| 			return err | ||||
| 		} | ||||
|   | ||||
| @@ -32,7 +32,7 @@ var describeExample = ktemplates.Examples(`  # Describe a URL | ||||
| %[1]s myurl | ||||
| `) | ||||
|  | ||||
| // URLListOptions encapsulates the options for the odo url list command | ||||
| // URLDescribeOptions encapsulates the options for the odo url describe command | ||||
| type URLDescribeOptions struct { | ||||
| 	localConfigInfo  *config.LocalConfigInfo | ||||
| 	componentContext string | ||||
| @@ -40,7 +40,7 @@ type URLDescribeOptions struct { | ||||
| 	*genericclioptions.Context | ||||
| } | ||||
|  | ||||
| // NewURLDescribeOptions creates a new URLCreateOptions instance | ||||
| // NewURLDescribeOptions creates a new NewURLDescribeOptions instance | ||||
| func NewURLDescribeOptions() *URLDescribeOptions { | ||||
| 	return &URLDescribeOptions{&config.LocalConfigInfo{}, "", "", &genericclioptions.Context{}} | ||||
| } | ||||
| @@ -66,7 +66,7 @@ func (o *URLDescribeOptions) Validate() (err error) { | ||||
| 	return util.CheckOutputFlag(o.OutputFlag) | ||||
| } | ||||
|  | ||||
| // Run contains the logic for the odo url list command | ||||
| // Run contains the logic for the odo url describe command | ||||
| func (o *URLDescribeOptions) Run() (err error) { | ||||
| 	if experimental.IsExperimentalModeEnabled() { | ||||
| 		if pushtarget.IsPushTargetDocker() { | ||||
|   | ||||
| @@ -17,6 +17,7 @@ type ProjectStatus struct { | ||||
| 	Active bool `json:"active"` | ||||
| } | ||||
|  | ||||
| // ProjectList holds a list of Project | ||||
| type ProjectList struct { | ||||
| 	metav1.TypeMeta `json:",inline"` | ||||
| 	metav1.ListMeta `json:"metadata,omitempty"` | ||||
|   | ||||
| @@ -4,7 +4,7 @@ import ( | ||||
| 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||||
| ) | ||||
|  | ||||
| // Storage | ||||
| // Storage holds the information about storage attached to the component | ||||
| type Storage struct { | ||||
| 	metav1.TypeMeta   `json:",inline"` | ||||
| 	metav1.ObjectMeta `json:"metadata,omitempty"` | ||||
|   | ||||
| @@ -6,7 +6,7 @@ import ( | ||||
| 	"k8s.io/apimachinery/pkg/types" | ||||
| ) | ||||
|  | ||||
| // createFakeDeployment creates a fake deployment with the given pod name and labels | ||||
| // CreateFakeDeployment creates a fake deployment with the given pod name and labels | ||||
| func CreateFakeDeployment(podName string) *appsv1.Deployment { | ||||
| 	fakeUID := types.UID("12345") | ||||
|  | ||||
|   | ||||
| @@ -755,7 +755,7 @@ func GetValidPortNumber(componentName string, portNumber int, portList []string) | ||||
| func GetValidExposedPortNumber(exposedPort int) (int, error) { | ||||
| 	// exposed port number will be -1 if the user doesn't specify any port | ||||
| 	if exposedPort == -1 { | ||||
| 		freePort, err := util.HttpGetFreePort() | ||||
| 		freePort, err := util.HTTPGetFreePort() | ||||
| 		if err != nil { | ||||
| 			return -1, err | ||||
| 		} | ||||
|   | ||||
| @@ -4,7 +4,7 @@ import ( | ||||
| 	"sync" | ||||
| ) | ||||
|  | ||||
| // A task to execute in a go-routine | ||||
| // ConcurrentTask is a task to execute in a go-routine | ||||
| type ConcurrentTask struct { | ||||
| 	ToRun func(errChannel chan error) | ||||
| } | ||||
| @@ -15,7 +15,7 @@ func (ct ConcurrentTask) run(errChannel chan error, wg *sync.WaitGroup) { | ||||
| 	ct.ToRun(errChannel) | ||||
| } | ||||
|  | ||||
| // Records tasks to be run concurrently with go-routines | ||||
| // ConcurrentTasks records tasks to be run concurrently with go-routines | ||||
| type ConcurrentTasks struct { | ||||
| 	tasks []ConcurrentTask | ||||
| } | ||||
|   | ||||
| @@ -105,7 +105,7 @@ func In(arr []string, value string) bool { | ||||
| 	return false | ||||
| } | ||||
|  | ||||
| // Hyphenate applicationName and componentName | ||||
| // NamespaceOpenShiftObject hyphenates applicationName and componentName | ||||
| func NamespaceOpenShiftObject(componentName string, applicationName string) (string, error) { | ||||
|  | ||||
| 	// Error if it's blank | ||||
| @@ -168,6 +168,7 @@ func ParseComponentImageName(imageName string) (string, string, string, string) | ||||
| 	return componentImageName, componentType, componentName, componentVersion | ||||
| } | ||||
|  | ||||
| // WIN represent the windows OS | ||||
| const WIN = "windows" | ||||
|  | ||||
| // ReadFilePath Reads file path form URL file:///C:/path/to/file to C:\path\to\file | ||||
| @@ -503,7 +504,7 @@ func GetSortedKeys(mapping map[string]string) []string { | ||||
| 	return keys | ||||
| } | ||||
|  | ||||
| //returns a slice containing the split string, using ',' as a separator | ||||
| // GetSplitValuesFromStr returns a slice containing the split string, using ',' as a separator | ||||
| func GetSplitValuesFromStr(inputStr string) []string { | ||||
| 	if len(inputStr) == 0 { | ||||
| 		return []string{} | ||||
| @@ -645,8 +646,8 @@ func DeletePath(path string) error { | ||||
| 	return nil | ||||
| } | ||||
|  | ||||
| // HttpGetFreePort gets a free port from the system | ||||
| func HttpGetFreePort() (int, error) { | ||||
| // HTTPGetFreePort gets a free port from the system | ||||
| func HTTPGetFreePort() (int, error) { | ||||
| 	listener, err := net.Listen("tcp", "localhost:0") | ||||
| 	if err != nil { | ||||
| 		return -1, err | ||||
| @@ -712,7 +713,7 @@ func HTTPGetRequest(url string) ([]byte, error) { | ||||
| 	return bytes, err | ||||
| } | ||||
|  | ||||
| // filterIgnores applies the glob rules on the filesChanged and filesDeleted and filters them | ||||
| // FilterIgnores applies the glob rules on the filesChanged and filesDeleted and filters them | ||||
| // returns the filtered results which match any of the glob rules | ||||
| func FilterIgnores(filesChanged, filesDeleted, absIgnoreRules []string) (filesChangedFiltered, filesDeletedFiltered []string) { | ||||
| 	for _, file := range filesChanged { | ||||
| @@ -737,7 +738,7 @@ func FilterIgnores(filesChanged, filesDeleted, absIgnoreRules []string) (filesCh | ||||
| 	return filesChangedFiltered, filesDeletedFiltered | ||||
| } | ||||
|  | ||||
| // Checks that the folder to download the project from devfile is | ||||
| // IsValidProjectDir checks that the folder to download the project from devfile is | ||||
| // either empty or only contains the devfile used. | ||||
| func IsValidProjectDir(path string, devfilePath string) error { | ||||
| 	files, err := ioutil.ReadDir(path) | ||||
| @@ -1131,6 +1132,7 @@ func sliceContainsString(str string, slice []string) bool { | ||||
| 	return false | ||||
| } | ||||
|  | ||||
| // AddFileToIgnoreFile adds a file to the gitignore file. It only does that if the file doesn't exist | ||||
| func AddFileToIgnoreFile(gitIgnoreFile, filename string) error { | ||||
| 	return addFileToIgnoreFile(gitIgnoreFile, filename, filesystem.DefaultFs{}) | ||||
| } | ||||
|   | ||||
| @@ -1144,7 +1144,7 @@ func TestRemoveRelativePathFromFiles(t *testing.T) { | ||||
| 	} | ||||
| } | ||||
|  | ||||
| func TestHttpGetFreePort(t *testing.T) { | ||||
| func TestHTTPGetFreePort(t *testing.T) { | ||||
| 	tests := []struct { | ||||
| 		name    string | ||||
| 		wantErr bool | ||||
| @@ -1156,9 +1156,9 @@ func TestHttpGetFreePort(t *testing.T) { | ||||
| 	} | ||||
| 	for _, tt := range tests { | ||||
| 		t.Run(tt.name, func(t *testing.T) { | ||||
| 			got, err := HttpGetFreePort() | ||||
| 			got, err := HTTPGetFreePort() | ||||
| 			if (err != nil) != tt.wantErr { | ||||
| 				t.Errorf("HttpGetFreePort() error = %v, wantErr %v", err, tt.wantErr) | ||||
| 				t.Errorf("HTTPGetFreePort() error = %v, wantErr %v", err, tt.wantErr) | ||||
| 				return | ||||
| 			} | ||||
| 			addressLook := "localhost:" + strconv.Itoa(got) | ||||
|   | ||||
| @@ -1,7 +1,6 @@ | ||||
| package integration | ||||
|  | ||||
| import ( | ||||
| 	"github.com/openshift/odo/pkg/util" | ||||
| 	"os" | ||||
| 	"path/filepath" | ||||
| 	"runtime" | ||||
| @@ -9,6 +8,8 @@ import ( | ||||
| 	"strings" | ||||
| 	"time" | ||||
|  | ||||
| 	"github.com/openshift/odo/pkg/util" | ||||
|  | ||||
| 	. "github.com/onsi/ginkgo" | ||||
| 	. "github.com/onsi/gomega" | ||||
|  | ||||
| @@ -44,7 +45,7 @@ var _ = Describe("odo debug command tests", func() { | ||||
| 			helper.CmdShouldPass("odo", "component", "create", "nodejs:latest", "--project", project, "--context", context) | ||||
| 			helper.CmdShouldPass("odo", "push", "--context", context) | ||||
|  | ||||
| 			httpPort, err := util.HttpGetFreePort() | ||||
| 			httpPort, err := util.HTTPGetFreePort() | ||||
| 			Expect(err).NotTo(HaveOccurred()) | ||||
| 			freePort := strconv.Itoa(httpPort) | ||||
|  | ||||
| @@ -109,7 +110,7 @@ var _ = Describe("odo debug command tests", func() { | ||||
| 			helper.CmdShouldPass("odo", "component", "create", "nodejs:latest", "nodejs-cmp-"+project, "--project", project, "--context", context) | ||||
| 			helper.CmdShouldPass("odo", "push", "--context", context) | ||||
|  | ||||
| 			httpPort, err := util.HttpGetFreePort() | ||||
| 			httpPort, err := util.HTTPGetFreePort() | ||||
| 			Expect(err).NotTo(HaveOccurred()) | ||||
| 			freePort := strconv.Itoa(httpPort) | ||||
|  | ||||
| @@ -132,7 +133,7 @@ var _ = Describe("odo debug command tests", func() { | ||||
| 			helper.CmdShouldPass("odo", "component", "create", "nodejs:latest", "nodejs-cmp-"+project, "--project", project, "--context", context) | ||||
| 			helper.CmdShouldPass("odo", "push", "--context", context) | ||||
|  | ||||
| 			httpPort, err := util.HttpGetFreePort() | ||||
| 			httpPort, err := util.HTTPGetFreePort() | ||||
| 			Expect(err).NotTo(HaveOccurred()) | ||||
| 			freePort := strconv.Itoa(httpPort) | ||||
|  | ||||
|   | ||||
| @@ -63,7 +63,7 @@ var _ = Describe("odo devfile debug command tests", func() { | ||||
| 			helper.RenameFile("devfile-with-debugrun.yaml", "devfile.yaml") | ||||
| 			helper.CmdShouldPass("odo", "push", "--debug") | ||||
|  | ||||
| 			httpPort, err := util.HttpGetFreePort() | ||||
| 			httpPort, err := util.HTTPGetFreePort() | ||||
| 			Expect(err).NotTo(HaveOccurred()) | ||||
| 			freePort := strconv.Itoa(httpPort) | ||||
|  | ||||
| @@ -120,7 +120,7 @@ var _ = Describe("odo devfile debug command tests", func() { | ||||
| 			helper.RenameFile("devfile-with-debugrun.yaml", "devfile.yaml") | ||||
| 			helper.CmdShouldPass("odo", "push", "--debug") | ||||
|  | ||||
| 			httpPort, err := util.HttpGetFreePort() | ||||
| 			httpPort, err := util.HTTPGetFreePort() | ||||
| 			Expect(err).NotTo(HaveOccurred()) | ||||
| 			freePort := strconv.Itoa(httpPort) | ||||
|  | ||||
| @@ -148,7 +148,7 @@ var _ = Describe("odo devfile debug command tests", func() { | ||||
| 			helper.RenameFile("devfile-with-debugrun.yaml", "devfile.yaml") | ||||
| 			helper.CmdShouldPass("odo", "push", "--debug") | ||||
|  | ||||
| 			httpPort, err := util.HttpGetFreePort() | ||||
| 			httpPort, err := util.HTTPGetFreePort() | ||||
| 			Expect(err).NotTo(HaveOccurred()) | ||||
| 			freePort := strconv.Itoa(httpPort) | ||||
|  | ||||
|   | ||||
| @@ -139,7 +139,7 @@ var _ = Describe("odo docker devfile url command tests", func() { | ||||
| 			stdout = helper.CmdShouldFail("odo", "url", "list") | ||||
| 			Expect(stdout).To(ContainSubstring("no URLs found")) | ||||
|  | ||||
| 			httpPort, err := util.HttpGetFreePort() | ||||
| 			httpPort, err := util.HTTPGetFreePort() | ||||
| 			Expect(err).NotTo(HaveOccurred()) | ||||
| 			freePort := strconv.Itoa(httpPort) | ||||
| 			helper.CmdShouldPass("odo", "url", "create", url1, "--exposed-port", freePort, "--now") | ||||
| @@ -190,7 +190,7 @@ var _ = Describe("odo docker devfile url command tests", func() { | ||||
| 			stdout = helper.CmdShouldFail("odo", "url", "describe", url1) | ||||
| 			Expect(stdout).To(ContainSubstring("the url " + url1 + " does not exist")) | ||||
|  | ||||
| 			httpPort, err := util.HttpGetFreePort() | ||||
| 			httpPort, err := util.HTTPGetFreePort() | ||||
| 			Expect(err).NotTo(HaveOccurred()) | ||||
| 			freePort := strconv.Itoa(httpPort) | ||||
| 			helper.CmdShouldPass("odo", "url", "create", url1, "--exposed-port", freePort, "--now") | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Girish Ramnani
					Girish Ramnani