* Add integration test case
Co-authored-by: Anand Kumar Singh <anandrkskd@gmail.com>
Co-authored-by: Philippe Martin <phmartin@redhat.com>
* Add ApplyOpenShift method to handler
* Test openhift component with odo dev
* Rename GetKubernetesComponentsToPush to GetK8sAndOcComponentsToPush and modify if to obtain both k8s and oc components
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Fix unit test failures with delete_test
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* update ListClusterResourcesToDeleteFromDevfile to fetch openshift component,Add ListOpenShiftComponents
Signed-off-by: anandrkskd <anandrkskd@gmail.com>
* fix testcase 'should have deleted the old resource and created the new resource' and add helper function ReplaceStrings
Signed-off-by: anandrkskd <anandrkskd@gmail.com>
* fix debug test to check openshift component
Signed-off-by: anandrkskd <anandrkskd@gmail.com>
* Update GetBindingsFromDevfile to include openshift components
* Update offline tests
* Add openshift component to devfiles
* Update tests
* Fix binding tests
* Fix RemoveBinding unit tests
* Handle OpenShift components when removing binding
* odo describe component displaysOpenShift components
* Remove unused function
---------
Signed-off-by: Parthvi Vala <pvala@redhat.com>
Signed-off-by: anandrkskd <anandrkskd@gmail.com>
Co-authored-by: Anand Kumar Singh <anandrkskd@gmail.com>
Co-authored-by: Philippe Martin <phmartin@redhat.com>
Co-authored-by: Parthvi Vala <pvala@redhat.com>
* Set platform and platformVersion in telemetry
* Vendor oc config client
* Get OC version
* Integration tests for odo dev
* Integration tests for odo deploy
* Update doc
* Apply suggestions from code review
Co-authored-by: Armel Soro <armel@rm3l.org>
* Add integration test on odo init
* Fix OC version when no complete version status
---------
Co-authored-by: Armel Soro <armel@rm3l.org>
* Refactor 'libdevfile#GetContainerEndpointMapping' so it returns the whole Endpoint struct
It will help extract useful information like the port name and exposure.
* Fix typo in parameter name (in portForward#Client interface)
* Display the port names in the output of 'odo describe component'
* Display the port exposures in the output of 'odo describe component'
* Tell whether the port is a debug one or not in the output of 'odo describe component'
* Add integration tests meeting the expectations
* Update documentation
This commit replaces `ioutil.TempDir` with `t.TempDir` in tests. The
directory created by `t.TempDir` is automatically removed when the test
and all its subtests [complete.
Prior to this commit, temporary directory created using `ioutil.TempDir`
needs to be removed manually by calling `os.RemoveAll`, which is omitted
in some tests. The error handling boilerplate e.g.
defer func() {
if err := os.RemoveAll(dir); err != nil {
t.Fatal(err)
}
}
is also tedious, but `t.TempDir` handles this for us nicely.
Reference: https://pkg.go.dev/testing#T.TempDir
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
* Display error message when odo dev fails on podman and clean resources on error
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* show complete podman output on error
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Only set deployedPod if it exists
Signed-off-by: Parthvi Vala <pvala@redhat.com>
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Add '--running-in' CLI flag to 'odo delete component'
* Use the provided 'running-in' to filter resources candidate for deletion on both cluster and Podman
* Update 'odo delete component' confirmation and success messages to mention the provided value for 'running-in'
* Add unit test cases
* Add integration test cases
* Extract sample outputs from delete-component command reference docs
* Add documentation for the '--running-in' flag
* Update the Devfile library
* Add test for container-overrides and pod-overrides attributes
Signed-off-by: Parthvi Vala <pvala@redhat.com>
Attempt at fixing CI failures
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Fix CI failure
* Attempt at fixing OC integration test failures
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Use random name in integration test
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Rebase and fix integration test failure
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Make integration test work for podman
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Temp attempt at fixing podman test for GH
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Another attempt at fixing CI test for podman
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* One more attempt at fixing integration test for podman
Signed-off-by: Parthvi Vala <pvala@redhat.com>
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Rename SetProjectName into GetProjectName
Co-authored-by: Anand Singh <ansingh@redhat.com>
Co-authored-by: Parthvi Vala <pvala@redhat.com>
Co-authored-by: Philippe Martin <phmartin@redhat.com>
* Generate specific containers.conf file for each test spec using a dedicated engine namespace
Co-authored-by: Anand Singh <ansingh@redhat.com>
Co-authored-by: Parthvi Vala <pvala@redhat.com>
Co-authored-by: Philippe Martin <phmartin@redhat.com>
* Listen on random ports on Podman when '--random-ports' is used
This reduces the risks of port conflicts when running test specs in parallel.
Co-authored-by: Philippe Martin <phmartin@redhat.com>
* Exclude Gosec G404 (use of math/rand) rule
Co-authored-by: Philippe Martin <phmartin@redhat.com>
* Run Podman specs in parallel
* Output the Pod spec to be played by Podman depending on verbosity level
This will help debug potential issues.
* Use random name in 'using devfile that contains K8s resource to run it on podman' test
* Use random component name in sample java-quarkus project used in 'a hotReload capable project is used with odo dev' test
* Revert "Run Podman specs in parallel"
Parallelization works great on GitHub Actions, but I experimented a lot
of issues when running locally with a lot (~11) of parallel test nodes.
Not sure why exactly, but some containers created by Podman had a lot of
networking issues.
We can look into parallelizing the runs later in a subsequent PR.
This reverts commit 64d5d31248a62f355a32ca245ba399a723fdb22f.
* Allow overridding the number of parallel nodes for Podman integration tests
This way, we could be able to run them in parallel on GitHub
but sequentially (default) locally.
This will still benefit us by reducing the time it takes to run such tests on GitHub.
Meanwhile, we can look into the issues we have locally with parallelization.
Note that it is still possible to run them locally in parallel via
the PODMAN_EXEC_NODE env var.
Co-authored-by: Anand Singh <ansingh@redhat.com>
Co-authored-by: Parthvi Vala <pvala@redhat.com>
Co-authored-by: Philippe Martin <phmartin@redhat.com>
* Fix: odo dev unable to sync files with name containing special characters
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Cover in unit tests and refactor them
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Add test for globEscape
Signed-off-by: Parthvi Vala <pvala@redhat.com>
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Describe remote source code location for container component
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Add integration test
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Fix cI failures
* Add extra check for .mountSources and add more integration tests
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Use GetMountSources() instead of property
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Use random name in integration test
Signed-off-by: Parthvi Vala <pvala@redhat.com>
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Add integration tests meeting the expectations
* Refactor 'libdevfile.GetContainerEndpointMapping' such that it returns debug endpoints only if told so
* [Kubernetes] Port-forward Debug endpoints only if running in Debug mode
* [Podman] Port-forward Debug endpoints only if running in Debug mode
* Use '--inspect' instead of '--inspect-brk' to run the "debug" script in Node.JS sample projects
'--inspect-brk' stops the execution at the start of the command
(waiting for a debugger to attach to it) while '--inspect' does not.
We need the application to be started regardless of whether a debugger
is attached or not, as we are testing that we can communicate with
the forwarded ports.
* Temporarily skip the test step on Podman that connects to the forwarded debug port until [1] is fixed
We can work on fixing the issue on Podman in a separate PR.
[1] https://github.com/redhat-developer/odo/issues/6510
* Ignore and show warning when handling Kubernetes components on Podman
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Only use comp names
* Add integration test
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* return early when there are no k8s resources to be created; get resources referenced by apply command and add test for it
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Warn about k8s resources that match the given CommandGroupKind
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Only warn about k8s resources for a given command and groupkind
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Amend the test case
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Add warning about image components referenced by an apply command and attempt at fixing CI failures
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Add warning inside ApplyImage and ApplyKubernetes methods
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Update pkg/dev/podmandev/reconcile.go
Co-authored-by: Armel Soro <armel@rm3l.org>
Signed-off-by: Parthvi Vala <pvala@redhat.com>
Co-authored-by: Armel Soro <armel@rm3l.org>
* Implement GetRunningPodFromSelector for podman
* Implement GetPodLogs for podman
* Same message in podman/cluster
* Integration tests
* Return stream of stdout/err
* Display a warning that "odo dev" on Podman might need to be restarted when local changes are detected
The initial idea was to display such a warning only
when changes are detected in the Devfile,
which are not yet handled completely at this time.
But to take into account the manual synchronization case (where
there is no file watcher (and therefore no way to determine which
files have actually been modified)), a generic warning is being
displayed whenever the Podman-specific watch handler is called.
* Add integration test case
* fixup! Add integration test case
* amend! Display a warning that "odo dev" on Podman might need to be restarted when local changes are detected
Display a warning that "odo dev" on Podman might need to be restarted when the Devfile is modified
* fixup! Add integration test case
* Assert that no warning is displayed if the Devfile has not changed
* Use podman generate kube instead podman kube generate
* get env from exec -it env (to be continued)
* Fix podman test
* Export function to make validate tests pass
* review
* Check podman tests result
Co-authored-by: Parthvi Vala <pvala@redhat.com>
* Do not use restmapper to map resource->kind for application. Juct copy Kind and Resource to json output
* Fix panic when no kubeclient
* Fix panic when odo list binding with --name
* Fix integration tests with new output
* odo dev works if no endpoint is defined
* Update tests/integration/cmd_dev_test.go
Co-authored-by: Armel Soro <armel@rm3l.org>
* Add log when no port to forward
Co-authored-by: Armel Soro <armel@rm3l.org>
* Rename pkg/odo/commonflags/run_on.go to pkg/odo/commonflags/platform.go and change runOn to platform
* Rename feature
* Rename into pkg/odo/commonflags/context/
* Update comments
* Update doc
* fix comment
* Update integration tests
* Duplicate runningOn field with platform + deprecated runningOn
* Mark RunningOn as Deprecated
* Do not modify blog post
* Fix typo
* Add exception for SA1019
* odo describe component
* Fix integration tests for odo describe component
* Allow using the '--run-on' flag with 'odo describe component'
* Add "platform" to the ForwardedPort output
* Move RunningMode* structs to a dedicated file and add (tested) method for merging running modes
* Add RunningOn field to the Component API
* Make component#GetRunningModes able to return all modes for all specified platforms
* Do not display the namespace from NoComponentFoundError if no namespace is set
* Add more validation logic to the 'describe component' CLI
* Update 'odo describe component' logic for Devfile-based component
* Update 'odo describe component' logic for name-based component
This checks for the component with such name on all platforms.
If it finds several components on both platforms, it needs to extract
Devfile information from those resources.
To do so, it checks if the relevant labels (project type and name) are matching.
It errors out if they do not match, because this would imply that we
don't know what to display as Devfile information.
* Conditionally display "running on" information in human-readable output.
This is displayed only if the "run-on" feature is enabled.
* Implement GetAllResourcesFromSelector in the PodmanCli client
* Add more unit tests
* Update integration tests
* fixup! Update integration tests
* fixup! fixup! Update integration tests
* odo delete component with name
* Add unit test
* Add integration tests
* common printDevfileComponents
* fix name
* spinners + newlines
* Update info message with podman and/or cluster
* Make odo delete component work without kubeconfig
* Make odo delete component work when non auth
* Support run-on flag
* Do not delete cluster resources when running on podman
* No error when deleting component by name without cluster
* Refacto cleanup pod
* Add PodLs and KubeGenerate methods to pkg/podman
* List and delete Podman Pods
* Add integration tests
* Fix msg + when experimental is disabled
* Review (except UT)
* Add unit test
* restrict platforms earlier
* Ask for stack version in the interactive mode; downloading still doesn't work as expected
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Download the versioned Devfile for interactive mode
* Download the versioned Devfile for flag mode
* Download the versioned Devfile for the alizer mode
* Add support for 'latest' stack
* Update init automation message with devfile-version
* Mark the default version in interactive mode
* Fix interactive tests
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Add integration tests for odo init flag mode
* Fix unit and validation tests
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Add to the documentation
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Add information about the default version
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Display a generic Experimental mode warning message when this mode is enabled
This fixes the issue of having this warning displayed for a specific feature
that might not be used by the user.
Instead, we are now displaying a more generic and feature-agnostic warning
message once.
* Drop useless 'id' field in OdoFeature struct
* Quick fix
* Test grouping of comands in odo help
* Create a CommandGroup abstraction
* Expect a non-nil Preference Client
Co-authored-by: Armel Soro <armel@rm3l.org>
Co-authored-by: Armel Soro <armel@rm3l.org>
* Add integration tests highlighting the issue and setting the expectations
* Fallback to interactive questions if there is no match from Alizer when initializing a component
This applies to odo init, odo dev and odo deploy
* Make the registry client collect and return all stack versions
* Call the '/v2index' endpoint first and fallback to the index endpoint when listing Stack versions
* Display the Stack versions in the 'odo registry' human-readable output
* For convenience, sort stack versions based on the semantic version
This allows seeing them in a meaningful order in both
human-readable and JSON outputs.
* Enrich unit tests for 'getRegistryStacks'
* Fill the "starterProjects" field for backward compatibility
Similar to the "version" field, this represents
the list of starter projects of the default Stack version.
* Update integration tests
* Update documentation
* Refacto get first free port
* Use next free port for Podman
* Save used ports to reuse them
* Fix unit tests
* Do not rely on system for ports during tests
* Improve confirmation message for namespace/project deletion
* Update sample output in ´delete namespace/project' command reference
* Use oc binary instead of odo in DeleteNamespaceProject 'helper_oc' implementation
This way, we do not rely on some other odo command (odo delete project command) in unrelated tests
This also makes it more consistent with the implementation in 'helper_kubectl'
* Rename GetK8sManifestWithVariablesSubstituted to GetK8sManifestsWithVariablesSubstituted
* Add GetK8sComponentAsUnstructuredList; add support for multiple manifests in a single k8s component
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Use GetK8sComponentAsUnstructuredList in binding/remove.go
* Use GetK8sComponentAsUnstructuredList in component/component_test.go
* Use GetK8sComponentAsUnstructuredList in libdevfile/component_kubernetes_utils.go
* Use GetK8sComponentAsUnstructuredList in service/service.go
* Use GetK8sComponentAsUnstructuredList in devfile/adapters/kubernetes/component/adapter.go
* Add documentation for GetK8sComponentAsUnstructuredList and remove GetK8sComponentAsUnstructured
* Fix createOrUpdateServiceForComponent to fetch only the service created for the component
* Add integration test for odo deploy
* Add integration test for odo dev
* Attempt at fixing list/describe binding tests; fixes old mishap
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Check for empty list of binding
Signed-off-by: Parthvi Vala <pvala@redhat.com>
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Enable run-on flag
* List all components
* Select specific platform with --run-on flag
* Make podmanClient nil if no podman client is accessible
* integration test
* Delay the display of warnings related to experimental features
* Add logs displaying podman commands executed
* Use None when Running On is empty
* odo list
* Do not display "Port configuration using flag is currently not supported"
This is confusing to users.
* Display ports detected as part of the Alizer component detection logic
This is because we specifically need to display the ports
at the same moment when the language, project type and Devfile
are displayed to the end user (when source code is present)
* Update the loaded Devfile object with the application ports detected prior to asking for its customization
The case of multi-container components will be handled in [1].
Otherwise, the container component ports (all but the Debug ports) are replaced with the right application ports.
[1] https://github.com/redhat-developer/odo/issues/6264
* Add integration test case
* Add application ports detected to "odo analyze -o json" output
* Update documentation
* Add utility functions for helping handle Debug endpoints
* Make application ports detected appear first in the endpoint list
This allows such ports to be port-forwarded first, before the Debug ones.