Skip to content

Commit d80a181

Browse files
authored
Merge pull request opendatahub-io#759 from diegolovison/doc5
How to debug using GoLand
2 parents c86983a + 6a5a1f7 commit d80a181

File tree

2 files changed

+37
-23
lines changed

2 files changed

+37
-23
lines changed

.github/scripts/tests/README.md

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,17 @@ To prevent file monitoring issues in development environments (e.g., IDEs or fil
88
sudo sysctl fs.inotify.max_user_instances=2280
99
sudo sysctl fs.inotify.max_user_watches=1255360
1010
```
11+
## Prerequisites
12+
* Kind https://kind.sigs.k8s.io/
13+
1114
## Create kind cluster
1215
```bash
1316
cat <<EOF | kind create cluster --name=kubeflow --config=-
1417
kind: Cluster
1518
apiVersion: kind.x-k8s.io/v1alpha4
1619
nodes:
1720
- role: control-plane
18-
image: kindest/node:v1.31.0@sha256:53df588e04085fd41ae12de0c3fe4c72f7013bba32a20e7325357a1ac94ba865
21+
image: kindest/node:v1.30.6@sha256:b6d08db72079ba5ae1f4a88a09025c0a904af3b52387643c285442afb05ab994
1922
kubeadmConfigPatches:
2023
- |
2124
kind: ClusterConfiguration
@@ -32,20 +35,20 @@ Instead of replacing your kubeconfig, we are going to set to a diff file
3235
kind get kubeconfig --name kubeflow > /tmp/kubeflow-config
3336
export KUBECONFIG=/tmp/kubeflow-config
3437
```
35-
# docker
38+
## docker
3639
In order to by pass the docker limit issue while downloading the images. Let's use your credentials
3740
```bash
38-
docker login
41+
docker login -u='...' -p='...' quay.io
3942
```
4043

4144
Upload the secret. The following command will return an error. You need to replace `to` with user `username`
4245
```bash
4346
kubectl create secret generic regcred \
44-
--from-file=.dockerconfigjson=/home/to/.docker/config.json \
47+
--from-file=.dockerconfigjson=$HOME/.docker/config.json \
4548
--type=kubernetes.io/dockerconfigjson
4649
```
4750

48-
# Test environment variables
51+
## Test environment variables
4952
Replace the `/path/to` in order to match the `data-science-pipelines-operator` folder
5053
```bash
5154
export GIT_WORKSPACE=/path/to/data-science-pipelines-operator
@@ -58,7 +61,34 @@ Replace `username` with your quay user
5861
export REGISTRY_ADDRESS=quay.io/username
5962
```
6063

61-
# Run the test
64+
## Run the test
6265
```bash
6366
sh .github/scripts/tests/tests.sh --kind
6467
```
68+
69+
# Debug a test using GoLand
70+
Let's say you wish to debug the `Should create a Pipeline Run` test.
71+
The first step is right click inside the method content and select the menu
72+
`Run 'TestIntegrationTestSuite'`. It will fail because you need to fill some parameters.
73+
Edit the configuration for `TestIntegrationTestSuite/TestPipelineSuccessfulRun/Should_create_a_Pipeline_Run in github.com/opendatahub-io/data-science-pipelines-operator/tests`
74+
````
75+
-k8sApiServerHost=https://127.0.0.1:39873
76+
-kubeconfig=/tmp/kubeflow-config
77+
-DSPANamespace=test-dspa
78+
-DSPAPath=/path/to/data-science-pipelines-operator/tests/resources/dspa-lite.yaml
79+
````
80+
## How to retrieve the parameters above
81+
* `k8sApiServerHost`: inspect the kubeconfig and retrieve the server URL from there
82+
* `kubeconfig`: the path where you stored the output of `kind get kubeconfig`
83+
* `DSPANamespace`: namespace
84+
* `DSPAPath`: full path for the dspa.yaml
85+
86+
`Should create a Pipeline Run`, `DSPANamespace` and `DSPAPath` depends on the test scenario.
87+
88+
If you wish to keep the resources, add `-skipCleanup=True` in the config above.
89+
90+
## If you wish to rerun the test you need to delete the dspa
91+
```bash
92+
$ kubectl delete datasciencepipelinesapplications test-dspa -n test-dspa
93+
datasciencepipelinesapplication.datasciencepipelinesapplications.opendatahub.io "test-dspa" deleted
94+
```

README.md

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -504,23 +504,7 @@ oc delete project ${ODH_NS}
504504

505505
## Run tests
506506

507-
Simply clone the directory and execute `make test`.
508-
509-
To run it without `make` you can run the following:
510-
511-
```bash
512-
tmpFolder=$(mktemp -d)
513-
go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest
514-
export KUBEBUILDER_ASSETS=$(${GOPATH}/bin/setup-envtest use 1.25.0 --bin-dir ${tmpFolder}/bin -p path)
515-
go test ./... -coverprofile cover.out
516-
517-
# once $KUBEBUILDER_ASSETS you can also run the full test suite successfully by running:
518-
pre-commit run --all-files
519-
```
520-
521-
You can find a more permanent location to install `setup-envtest` into on your local filesystem and export
522-
`KUBEBUILDER_ASSETS` into your `.bashrc` or equivalent. By doing this you can always run `pre-commit run --all-files`
523-
without having to repeat these steps.
507+
See `.github/scripts/tests/README.md`(https://github.com/opendatahub-io/data-science-pipelines-operator/blob/main/.github/scripts/tests/README.md)
524508

525509
## Metrics
526510

0 commit comments

Comments
 (0)