Comments (5)
That being said I'm gonna change the template to not add the operator to the supervision tree in :test env. Thanks for the issue.
from bonny.
What is the errors you see? Can you try with mix test --no-start
?
from bonny.
What is the errors you see? Can you try with
mix test --no-start
?
The error and steps are in the repro link, but reposting here.
** (Mix) Could not start application bonny_example: BonnyExample.Application.start(:normal, [env: :test]) returned an error: shutdown: failed to start child: BonnyExample.Operator
** (EXIT) shutdown: failed to start child: %K8s.Operation{api_version: "bonny-example.test.com/v1", data: nil, method: :get, name: "BonnyExample", path_params: [namespace: "default"], query_params: [], verb: :list}
** (EXIT) exited in: GenServer.call(K8s.Client.DynamicHTTPProvider, {:locate, #PID<0.352.0>}, 5000)
** (EXIT) no process: the process is not alive or there's no process currently associated with the given name, possibly because its application isn't started
from bonny.
mix test --no-start
looks like it works. Is that the intended way to run the tests? --no-start refers to the application?
from bonny.
--no-start refers to the application?
Yes, it means don't start the appilcation. But it is actually documented.
Is that the intended way to run the tests?
It depends on how you want to test your operator. Do you want to implement and run only unit tests or do you want to test it agains a real kubernetes cluster (integration tests) as well?
Unit tests only
You have two options:
- Use
--no-start
as described above - In your appilcation.ex you get the mix environment. For
:dev
don't add the operator to the supervision tree
defmodule YourOperator.Application do
use Application
def start(_type, env: env) do
children =
case env do
:test -> []
_ -> [{YourOperator.Operator, conn: YourOperator.K8sConn.get!(env), name: YourOperator.Operator}]
end
opts = [strategy: :one_for_one, name: YourOperator.Supervisor]
Supervisor.start_link(children, opts)
end
end
With integration tests
This is advanced but if you want to run integration tests you're gonna have to create a local cluster (e.g. using k3d) and connect to that cluster. So you have to change YourOperator.K8sConn.get!(:test)
to return a conn object to your local cluster. Make sure you generate the manifest and apply it to your cluster before you start the operator. This repository actually comes with integration tests. Use it to get inspired.
from bonny.
Related Issues (20)
- Operator does not create the resources HOT 12
- Reduce Code Generation HOT 2
- Error :cluster_not_registered HOT 1
- Error on create HPA resource HOT 7
- The current CRD from `mix bonny.gen.manifest` doesn't work on later version of k8s HOT 19
- Missing priv folder in hex release 0.5.0 HOT 1
- cluster_name/0 is undefined HOT 4
- mix bonny.gen.manifest add an override callback
- Implement observedGeneration
- Multiple controllers handling same descendant kind HOT 7
- An error is being thrown for deployments but not hpas. HOT 4
- Use strategic merge patch to add finalizers HOT 1
- Add multiple different resources with the same name in the pipeline for register_descendants
- Reconciled deletes don't seem to happen easily HOT 3
- Leader Election HOT 5
- Bonny Events throw without :operator_name in prod HOT 2
- Error with dependent resources HOT 7
- LeaderElector error on leader change HOT 2
- FIPS mode HOT 22
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bonny.