In this commit, we unify the generation of random string
length by utilizing `RandomStrLength` global constant.
Signed-off-by: Mohamed Awnallah <mohamedmohey2352@gmail.com>
In this commit, we add e2e tests for the `karmadactl taint`
command to ensure it handles various scenarios correctly.
The tests include:
- Applying taints with different effects (NoSchedule, NoExecute) to a cluster.
- Reapplying taints without the `--overwrite` flag to ensure an error is returned.
- Overwriting existing taints using the `--overwrite` flag.
- Removing taints from a cluster.
- Running the taint command in `--dry-run` mode to ensure no actual changes are made.
- Verifying that taints were not applied during `--dry-run` mode.
- Ensuring the command returns an error for an invalid flag.
- Ensuring the command returns an error when attempting to taint a non-existent cluster.
Signed-off-by: Mohamed Awnallah <mohamedmohey2352@gmail.com>
Co-authored-by: zhzhuang-zju <m17799853869@163.com>
In this commit, we unify access to cluster members
in `test/helper/NewFederatedResourceQuota()` by passing
`clusterNames` as an input parameter. This commit is also
a follow-up of this PR #5226.
Signed-off-by: Mohamed Awnallah <mohamedmohey2352@gmail.com>
In this commit, we test `karmadactl options` on listing
all available global options successfully and returning
an error for invalid flag in options.
Signed-off-by: Mohamed Awnallah <mohamedmohey2352@gmail.com>
In this commit, we add tests for the `karmadactl token`
command. These include creating, deleting, listing, and
validating bootstrap tokens. We test scenarios such as
successful token creation and deletion, error handling
for invalid flag, and ensuring the correct format for
tokens. The utility functions `extractTokenIDAndSecret`
and `validateTokenFormat` are used to validate token
format and extract token components.
Signed-off-by: Mohamed Awnallah <mohamedmohey2352@gmail.com>
Co-authored-by: zhzhuang-zju <m17799853869@163.com>
In this commit, we test `karmadactl describe` command
on existing resource, non-existing resource, non-existing
namespace, and invalid resource type.
Signed-off-by: Mohamed Awnallah <mohamedmohey2352@gmail.com>
In this commit, we test `karmadactl get` command
on existing resource, non-existing resource, and
invalid resource type.
Signed-off-by: Mohamed Awnallah <mohamedmohey2352@gmail.com>
In this commit, we test `karmadactl version` command to
make sure it return valid information and return error
when invalid flag is provided.
Signed-off-by: Mohamed Awnallah <mohamedmohey2352@gmail.com>
In this commit, we test `karmadactl logs` command
on existing cluster, existing pod, non-existing pod,
non-existing cluster, and invalid input.
Signed-off-by: Mohamed Awnallah <mohamedmohey2352@gmail.com>
The new k8s.io/utils/ptr package provides generic wrapper functions,
which can be used instead of type-specific pointer wrapper functions.
This replaces the latter with the former, and migrates other uses of
the deprecated pointer package to ptr in affacted files.
See kubernetes/utils#283 for details.
Signed-off-by: Lan Liang <gcslyp@gmail.com>