litmuschaos / admission-controllers

Admission Controllers used in LitmusChaos
Apache License 2.0
7 stars 6 forks source link

Add BDD and unit testcases #2

Open rahulchheda opened 4 years ago

rahulchheda commented 4 years ago

Needed to build some BDD and unit testcases for admission webhook.

Tracking this here: https://github.com/litmuschaos/litmus/issues/2182

Abhishek-kumar09 commented 4 years ago

@rahulchheda Can you help with getting started with this issue.

rahulchheda commented 4 years ago

Hey @Abhishek-kumar09, sorry for the delay. So, we need to create unit tests for each of the file which is easy to do if we can leverage the use of https://godoc.org/k8s.io/client-go/kubernetes/fake. Mainly we focus on the file webhook.go which is responsible for the validation. The steps we perform for creating a Validation Webhook should be done using Fake Client, and then testcases (or choasengines and the resources it refers) should be created to check the behaviour of Admission Controllers.

christopherfriedrich commented 4 years ago

@rahulchheda when adding the copyright & license info to the test file should i use 2020 or 2019 as year?

rahulchheda commented 4 years ago

I think 2019 would be good. WDYT @ksatchit ?

sagnik3788 commented 2 months ago

@rahulchheda, can I take this issue if it hasn’t been completed ?