In this commit, we fix flaky test in `store_test.go` by using
`GetCert` to retrieve secrets instead of unreliable `CertList`
indexing due to non-guarnteed map order.
Signed-off-by: Mohamed Awnallah <mohamedmohey2352@gmail.com>
In this commit, we introduce unit tests for operator `certs` package.
The test cases include but not limited to:
- Test private key generation.
- Test self-signed certificate authority (CA) generation.
- Verify creation of self-signed certificate and key files within the CA.
- Include tests for utility functions, such as appending to Subject Alternative Names in SSL/TLS certificates.
- Add tests for Karmada Store operations related to certificates stored in Kubernetes Secrets:
- Create
- Read
- Update
- Load
Signed-off-by: Mohamed Awnallah <mohamedmohey2352@gmail.com>
In this commit, we enhance the `GeneratePrivateKey` and `ParsePrivateKeyPEM` functions:
- Added validation for unsupported key types and provided a more descriptive error message.
This function supports ECDSA (using P-256) and RSA (with a key size of 3072 bits) algorithms.
It returns an error for unsupported key types.
- Improved error handling to include the type of the unsupported key format in the error message.
This function now provides more informative feedback when the private key format is neither RSA nor ECDSA.
Signed-off-by: Mohamed Awnallah <mohamedmohey2352@gmail.com>
In this commit, we unit test rbac in the karmada init task
operator package by checking that cluster roles and their associated
cluster role bindings are created as expected.
Signed-off-by: Mohamed Awnallah <mohamedmohey2352@gmail.com>
In this commit, we add unit tests for the RBAC in the karamada resource
operator pkg making sure Karmada Resource View Clusterrole and Karmada
Resource Edit Clusterrole are working as expected.
Signed-off-by: Mohamed Awnallah <mohamedmohey2352@gmail.com>
In this commit, we include unit tests for karmada search in the
operator control plane package to make sure installing karmada search
and its associated service are working as expected.
Signed-off-by: Mohamed Awnallah <mohamedmohey2352@gmail.com>
In this commit, we add unit tests for the metrics adapter controlplane pkg
of the operator making sure that installing Karmada Metrics Adapter Deployment
works as expect and its associated service.
Signed-off-by: Mohamed Awnallah <mohamedmohey2352@gmail.com>
In this commit, we include unit test cases for the etcd controlplane
pkg of the operator making sure that installing Karmada Etcd Statefulset
works as expected and its associated Etcd client/peer services.
Signed-off-by: Mohamed Awnallah <mohamedmohey2352@gmail.com>
In this commit, we introduce unit tests for both control plane
apiserver and aggregated apiserver for the operator.
Signed-off-by: Mohamed Awnallah <mohamedmohey2352@gmail.com>
In this commit, we unit test the patcher in the karmada operator
pkg on patching the Deployment and StatefulSet K8S objects.
Signed-off-by: Mohamed Awnallah <mohamedmohey2352@gmail.com>
In this commit, we unit test the API client on waiting for API server,
API service, all pods constraint, some pods constraint, and the exponential
backoff utility.
Signed-off-by: Mohamed Awnallah <mohamedmohey2352@gmail.com>
In this commit, we unit test wait init task on waiting for Karmada APIServer
and Karmada Control Plane components.
Signed-off-by: Mohamed Awnallah <mohamedmohey2352@gmail.com>
In this commit, we unit test component deinit task in the karmada
operator package on removing component subtasks and etcd component.
Signed-off-by: Mohamed Awnallah <mohamedmohey2352@gmail.com>
In this commit, we unit test kubeconfig deinit task in the operator
package on cleaning up the secret if it has the given labels.
Signed-off-by: Mohamed Awnallah <mohamedmohey2352@gmail.com>
In this commit, we unit test the job workflow in the operator
package on initializing the running data runtime interface and
running tasks and subtasks recursively.
Signed-off-by: Mohamed Awnallah <mohamedmohey2352@gmail.com>
In this commit, we unit test kubeconfig utility in the karmada
operator package on building client from secret reference and checking
whether the given cluster is local or remote.
Signed-off-by: Mohamed Awnallah <mohamedmohey2352@gmail.com>
Co-authored-by: zhzhuang-zju <m17799853869@163.com>
In this commit, we unit test template on parsing template functionality
on parsing and executing html templates with passed args.
Signed-off-by: Mohamed Awnallah <mohamedmohey2352@gmail.com>