-
Notifications
You must be signed in to change notification settings - Fork 698
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor: Eliminate Global Variable to Enhance Testability #4685
base: master
Are you sure you want to change the base?
Conversation
Hello @namkyu1999 Please review my pull request |
can you check DCO? |
@namkyu1999 Sir, as you instructed, I've tried to complete the checks. Could you please verify them? If there are any changes needed in the code, please let me know, and I'll try to fix them |
Hi @andoriyaprashant, some checks are failing now (build-pipeline, CIFuzz). can you check them? |
i am working on those 👍🏻 |
@@ -32,8 +32,8 @@ type MongoOperations struct { | |||
} | |||
|
|||
var ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we remove this var block itself as well.
@@ -10,20 +10,20 @@ import ( | |||
) | |||
|
|||
// CreateConfig creates a new server config with unique key | |||
func CreateConfig(ctx context.Context, config *ServerConfig) error { | |||
err := mongodb.Operator.Create(ctx, mongodb.ServerConfigCollection, config) | |||
func CreateConfig(ctx context.Context, config *ServerConfig, mongodbOperator mongodb.MongoOperator) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to create an interface and receivers here similar to what we have in other places?
Hello @Saranya-jena @Jonsy13 @namkyu1999 |
The checks are failing can you fix those? |
@andoriyaprashant are you still working on this PR? |
Sorry @Saranya-jena I forgot to check the pull request checks. I'll fix them as soon as possible 👍🏻 |
@andoriyaprashant the checks are still failing, PTAL. |
Ma'am @Saranya-jena , can you please help me or guide me in fixing the CIFuzz workflow error? I tried, but I am not able to understand it |
5bc31c5
to
30cea9a
Compare
updated-dependencies: - dependency-name: github.com/99designs/gqlgen dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: andoriyaprashant <[email protected]>
Bumps [github.com/vektah/gqlparser/v2](https://github.com/vektah/gqlparser) from 2.5.11 to 2.5.12. - [Release notes](https://github.com/vektah/gqlparser/releases) - [Commits](vektah/gqlparser@v2.5.11...v2.5.12) --- updated-dependencies: - dependency-name: github.com/vektah/gqlparser/v2 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: andoriyaprashant <[email protected]>
Signed-off-by: andoriyaprashant <[email protected]>
Signed-off-by: Saranya-jena <[email protected]> Signed-off-by: andoriyaprashant <[email protected]>
Signed-off-by: Shubham Chaudhary <[email protected]> Signed-off-by: andoriyaprashant <[email protected]>
Signed-off-by: andoriyaprashant <[email protected]>
Signed-off-by: andoriyaprashant <[email protected]>
Signed-off-by: andoriyaprashant <[email protected]>
* upgrade go version in all the modules Signed-off-by: Saranya-jena <[email protected]> * upgrade go version in dockerfiles Signed-off-by: Saranya-jena <[email protected]> * upgrade go version in github actions Signed-off-by: Saranya-jena <[email protected]> * updated go sum Signed-off-by: Saranya-jena <[email protected]> * updated subscriber dockerfile Signed-off-by: Saranya-jena <[email protected]> --------- Signed-off-by: Saranya-jena <[email protected]> Signed-off-by: andoriyaprashant <[email protected]>
* Added env support to enable/disable gql introspection Signed-off-by: Saranya-jena <[email protected]> * resolved comments Signed-off-by: Saranya-jena <[email protected]> * fixed imports Signed-off-by: Saranya-jena <[email protected]> * fixed build issues Signed-off-by: Saranya-jena <[email protected]> --------- Signed-off-by: Saranya-jena <[email protected]> Signed-off-by: andoriyaprashant <[email protected]>
Signed-off-by: Saranya-jena <[email protected]> Signed-off-by: andoriyaprashant <[email protected]>
Signed-off-by: Jongwoo Han <[email protected]> Co-authored-by: Namkyu Park <[email protected]> Signed-off-by: andoriyaprashant <[email protected]>
Signed-off-by: Jongwoo Han <[email protected]> Signed-off-by: andoriyaprashant <[email protected]>
…os#4830) Signed-off-by: Shubham Chaudhary <[email protected]> Signed-off-by: andoriyaprashant <[email protected]>
…os#4666) * fix: Invalid version details in backend. Signed-off-by: JanhaviAlekar <[email protected]> * Checking CIVersion at start Signed-off-by: JanhaviAlekar <[email protected]> --------- Signed-off-by: JanhaviAlekar <[email protected]> Co-authored-by: Vedant Shrotria <[email protected]> Co-authored-by: Amit Kumar Das <[email protected]> Co-authored-by: Namkyu Park <[email protected]> Signed-off-by: andoriyaprashant <[email protected]>
Signed-off-by: andoriyaprashant <[email protected]> Co-authored-by: Namkyu Park <[email protected]> Signed-off-by: andoriyaprashant <[email protected]>
Bumps [github.com/99designs/gqlgen](https://github.com/99designs/gqlgen) from 0.17.47 to 0.17.49. - [Release notes](https://github.com/99designs/gqlgen/releases) - [Changelog](https://github.com/99designs/gqlgen/blob/master/CHANGELOG.md) - [Commits](99designs/gqlgen@v0.17.47...v0.17.49) --- updated-dependencies: - dependency-name: github.com/99designs/gqlgen dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: andoriyaprashant <[email protected]>
…uschaos#4692) Signed-off-by: andoriyaprashant <[email protected]> Co-authored-by: Saranya Jena <[email protected]> Signed-off-by: andoriyaprashant <[email protected]>
…haos#4762) Signed-off-by: Denish Tomar <[email protected]> Co-authored-by: Saranya Jena <[email protected]> Signed-off-by: andoriyaprashant <[email protected]>
Signed-off-by: JanhaviAlekar <[email protected]> Co-authored-by: Namkyu Park <[email protected]> Co-authored-by: Sahil <[email protected]> Signed-off-by: andoriyaprashant <[email protected]>
…itmuschaos#4813) Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.25.0 to 0.26.0. - [Commits](golang/crypto@v0.25.0...v0.26.0) --- updated-dependencies: - dependency-name: golang.org/x/crypto dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: andoriyaprashant <[email protected]>
Bumps [go.mongodb.org/mongo-driver](https://github.com/mongodb/mongo-go-driver) from 1.15.0 to 1.16.1. - [Release notes](https://github.com/mongodb/mongo-go-driver/releases) - [Commits](mongodb/mongo-go-driver@v1.15.0...v1.16.1) --- updated-dependencies: - dependency-name: go.mongodb.org/mongo-driver dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: andoriyaprashant <[email protected]>
Signed-off-by: Baalekshan <[email protected]> Signed-off-by: andoriyaprashant <[email protected]>
Signed-off-by: Suyeon Jung <[email protected]> Signed-off-by: andoriyaprashant <[email protected]>
Bumps [go.mongodb.org/mongo-driver](https://github.com/mongodb/mongo-go-driver) from 1.15.1 to 1.16.1. - [Release notes](https://github.com/mongodb/mongo-go-driver/releases) - [Commits](mongodb/mongo-go-driver@v1.15.1...v1.16.1) --- updated-dependencies: - dependency-name: go.mongodb.org/mongo-driver dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Saranya Jena <[email protected]> Signed-off-by: andoriyaprashant <[email protected]>
Signed-off-by: hursit <[email protected]> Signed-off-by: andoriyaprashant <[email protected]>
Signed-off-by: JanhaviAlekar <[email protected]> Signed-off-by: andoriyaprashant <[email protected]>
Signed-off-by: JanhaviAlekar <[email protected]> Co-authored-by: Namkyu Park <[email protected]> Signed-off-by: andoriyaprashant <[email protected]>
…os#4779) * Adding environment filter in Infrastructure selection modal Signed-off-by: JanhaviAlekar <[email protected]> * setting initialAllInfrastructureLength as 0 initially Signed-off-by: JanhaviAlekar <[email protected]> * making InitialAllInfrastructureLength consistent Signed-off-by: JanhaviAlekar <[email protected]> * Scroll env list and Pagination(infra) Signed-off-by: JanhaviAlekar <[email protected]> * added preSelectedEnvironmentID Signed-off-by: JanhaviAlekar <[email protected]> * Minor changes in code Signed-off-by: JanhaviAlekar <[email protected]> * Refactored code Signed-off-by: JanhaviAlekar <[email protected]> * Changing height of infralist section Signed-off-by: JanhaviAlekar <[email protected]> * Minor improvements Signed-off-by: JanhaviAlekar <[email protected]> --------- Signed-off-by: JanhaviAlekar <[email protected]> Co-authored-by: Sahil <[email protected]> Co-authored-by: Saranya Jena <[email protected]> Signed-off-by: andoriyaprashant <[email protected]>
Signed-off-by: 잉퓨 <[email protected]> Co-authored-by: Namkyu Park <[email protected]> Co-authored-by: Saranya Jena <[email protected]> Co-authored-by: Vedant Shrotria <[email protected]> Signed-off-by: andoriyaprashant <[email protected]>
litmuschaos#4866) Signed-off-by: DongYoung Kim <[email protected]> Signed-off-by: andoriyaprashant <[email protected]>
Bumps [github.com/tidwall/gjson](https://github.com/tidwall/gjson) from 1.17.1 to 1.17.3. - [Commits](tidwall/gjson@v1.17.1...v1.17.3) --- updated-dependencies: - dependency-name: github.com/tidwall/gjson dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Saranya Jena <[email protected]> Signed-off-by: andoriyaprashant <[email protected]>
* test: add fuzz test to GetChartsPath function in handler Signed-off-by: Soyeon Park <[email protected]> * test: add fuzz test to FuzzReadExperimentFile function in handler * Removed the ./types.go example in unit test handler_test.go/TestReadExperimentFile because it returns a file does not exist error, not the file is not a yaml error that the test is intended to return. Signed-off-by: Soyeon Park <[email protected]> * * test: Add the FuzzReadExperimentYAMLFile test in the handler_fuzz_test.go file Signed-off-by: Soyeon Park <[email protected]> * test: add fuzz test to FuzzIsFileExisting function in handler Signed-off-by: Soyeon Park <[email protected]> * test: add fuzz test to FuzzGetExperimentData, FuzzUnzipRemoteHub function in handler Signed-off-by: Soyeon Park <[email protected]> * refactor: remove unused imported library Signed-off-by: Soyeon Park <[email protected]> * fix: check yaml: control characters are not allowed Signed-off-by: Soyeon Park <[email protected]> * refactor: save goimport order Signed-off-by: Soyeon Park <[email protected]> --------- Signed-off-by: Soyeon Park <[email protected]> Signed-off-by: andoriyaprashant <[email protected]>
* add handler_fuzz_test file Signed-off-by: weeeeestern <[email protected]> * add service_fuzz_test file Signed-off-by: weeeeestern <[email protected]> * test: add fuzz test Signed-off-by: weeeeestern <[email protected]> * test: add fuzz_test Signed-off-by: weeeeestern <[email protected]> * test: modify fuzz-test Signed-off-by: weeeeestern <[email protected]> * test: modify fuzz-test Signed-off-by: weeeeestern <[email protected]> --------- Signed-off-by: weeeeestern <[email protected]> Co-authored-by: Namkyu Park <[email protected]> Co-authored-by: Saranya Jena <[email protected]> Signed-off-by: andoriyaprashant <[email protected]>
…only a single namespace (litmuschaos#4680) * Create a seperate function to get Namespace in subscriber Signed-off-by: Calvin Audier <[email protected]> * Update graphql server to include KubeNamespace call (model not generated) Signed-off-by: Calvin Audier <[email protected]> * Update graphqls to include KubeNamespace model Update objectmodel and subscriber to incldue KubeNamespace Signed-off-by: Calvin Audier <[email protected]> * Fix issue in graphqls and adding KubeNamespace type. Regenerating model with gqlgen. Signed-off-by: Calvin Audier <[email protected]> * Update model to includude missing field in KubeNamespaceData Rename getKubeNamespace function that didn't match graphqls operation in Subscription Add missing function for the graphql server to retrieve list of namespace Signed-off-by: Calvin Audier <[email protected]> * Add remaining function in k8s pkg and requests to return list of namespace Signed-off-by: Calvin Audier <[email protected]> * Update graphql/subscriber to transform KubeObject to not be a array since subscriber will only return one element. Signed-off-by: Calvin Audier <[email protected]> * Update web server to seperate call for KubeObject and KubeNamespace. Signed-off-by: Calvin Audier <[email protected]> * Fix import with goimports Signed-off-by: Calvin Audier <[email protected]> * Reverting upgrade of webpack-dev-server so it's compatible with github workflow Signed-off-by: Calvin Audier <[email protected]> * Run gofmt with correct version. Signed-off-by: Calvin Audier <[email protected]> * Bumping ubi-minimal:8.8 to 8.10 to fix some HIGH CVE severity detected by trivy. Signed-off-by: Calvin Audier <[email protected]> * Updating chaos_infrastructure mock to include KubeNamespace. Fix a comment Signed-off-by: Calvin Audier <[email protected]> * Fix issue from Codacy Removing some unused code Signed-off-by: Calvin Audier <[email protected]> * Fix codacy issue: - Add some trailing comma - Trying transform subscription function to resolve "non-arrow functions are forbidden" - Add null check Signed-off-by: Calvin Audier <[email protected]> * Continue fix Codacy issue - Adding trailing comma - Re-ordering by alphabetic order some parameters Signed-off-by: Calvin Audier <[email protected]> --------- Signed-off-by: Calvin Audier <[email protected]> Signed-off-by: Calvinaud <[email protected]> Co-authored-by: Namkyu Park <[email protected]> Co-authored-by: Saranya Jena <[email protected]> Signed-off-by: andoriyaprashant <[email protected]>
Signed-off-by: Prashant Andoriya <[email protected]>
Hi @andoriyaprashant , can you please rebase with main? The current commit history is incorrect which is why it's pulling a lot of extra commits too. |
Signed-off-by: Prashant Andoriya <[email protected]>
Fixes #4217
Proposed changes
This pull request refactors the codebase by removing a global variable to improve testability.
Types of changes
What types of changes does your code introduce to Litmus? Put an
x
in the boxes that applyChecklist
Put an
x
in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.