Is it expected that tests require network connection to succeed? #4021
-
I'm using kubebuilder 4.1.0 and created a new project with the following commands
make test failure logs
Setting make test failure logs with control plane output
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
It seems like you're encountering issues with setting up the test environment for your kubebuilder project where the control plane fails to start without a network connection. This typically happens due to missing binaries or improper environment setup that kubebuilder/testdata/project-v4/Makefile Lines 176 to 180 in c3a5806 These binaries include:
Ensure that all required binaries are correctly installed and accessible in your environment. The error logs suggest that the I would recommend always first trying to use the default scaffold and testing it out. The Deploy Image Plugin might be of interest. This plugin scaffolds a project complete with code and tests for deploying and managing an image. It serves as a comprehensive example of how to structure your tests and configurations. You can also examine a sample project that uses this plugin at : https://github.com/kubernetes-sigs/kubebuilder/tree/master/testdata/project-v4-with-deploy-image. I hope, these resources should help you better understand how to configure and manage your testing environment effectively. However, if you have changed the default configuration which is scaffolded by default, you might consider configuring So, to answer your question:
In the default scaffold (without ANY customization) the answer is NO. Closing this one as sorted out. However, feel free to re-open if you see fit. |
Beta Was this translation helpful? Give feedback.
-
Hi @davidxia, I did the tests locally to troubleshoot this issue. Here are the steps: Verifying that tests do not work well without a network and with the binaries installed:(NOTE: I am using the testdata/project-v4 sample to do the tests)
WHY it fails? Why I cannot run make test without network?Follow the steps to troubleshooting and understand how it works You can start all binaries locally, so you need to start etcd first to be able to run kube-apiserver. With an internet connection:
Pre-requirements:
Check it running with:
You will see that everything works.
Now, if you turn off the internet, you will see that kube-apiserver cannot run:
However, if we try:
It seems that could work but errors still been faced
CONCLUSION
If you wish to use this without network. Would be possible raise an RFE:Then, the steps to address this one are:
How can I do my tests without network at the moment? Has any possibility to do so?Yes. Note that you can have installed locally kind for example. (https://kind.sigs.k8s.io/) and it will run without network which give me a hint that kube-apiserver also can allow it and we are just not knowing how to configure it to do so. (If we discovery how then we can see if controller-runtime can work within) Anyway, you will configure ENVTEST to use a pre-existent cluster instead of the binaries. In this case the cluster needs to be there and you need to use So, I think we can conclude this one. Not sure what more we could to do here to help you out. |
Beta Was this translation helpful? Give feedback.
Hi @davidxia,
I did the tests locally to troubleshoot this issue. Here are the steps:
Verifying that tests do not work well without a network and with the binaries installed:
(NOTE: I am using the testdata/project-v4 sample to do the tests)
WHY it fails? Why I cannot run make test without network?
Follow the steps to troubleshooting and understand how it works
You can start all binaries locally, so you need to start etcd first to be able to run kube-apiserver.
With an internet connection: