Closed AkashKumar7902 closed 6 months ago
Hey @Sarthak160 Can you please review it ?
P.S.: I haven't implemented the regex logic yet. Will implement it once a round of review is completed.
Hey @AkashKumar7902 , Can you please fix the conflicts so that I could test and get this merge ?
@AkashKumar7902 Please fix the build fail !
Hey @AkashKumar7902 please fix the error
Error: pkg/service/test/output.go:32:113: cannot use map[string]string{} (value of type map[string]string) as map[string][]string value in struct literal
Error: pkg/service/test/output.go:40:42: cannot use exp (variable of type string) as map[string]string value in assignment
Error: pkg/service/test/output.go:40:47: cannot use act (variable of type string) as map[string]string value in assignment
Error: pkg/service/test/test.go:568:76: too many arguments in call to logDiffs.PushHeaderDiff
have (string, string, string, map[string][]string)
want (string, string, map[string][]string)
and Please start working on this PR after merging this PR only, becuase you have built this feature on top of config PR right! So conflicts will be cleared once you merge that 982 PR.
Can you also add the screenshots of testing you have done in PR template?
Can you also add the screenshots of testing you have done in PR template?
done!
Hey @AkashKumar7902, Currently if keploy-config.yaml is not present , it logs an error for that . I think that should not be the situation as config file is an optional file not necessity for now .
@Sarthak160 hey I have made the changes!
Hey @AkashKumar7902 will review the changes by EOD.
Please update readme with the config feature and create an issue in the docs for this feature update.
Hey @charankamarapu
in match.go, we have:
for i := 0; i < expSlice.Len(); i++ {
isMatchedElement := false
for j := 0; j < actSlice.Len(); j++ {
if x, err := jsonMatch(key, expSlice.Index(i).Interface(), actSlice.Index(j).Interface(), noiseMap); err == nil && x {
isMatchedElement = true
break
}
}
isMatched = isMatchedElement && isMatched
}
I think this will yield unexpected output in some cases.
Consider a case: expslice = ['a', 'a', 'b', 'c'] actslice = ['a', 'b', 'c', 'c']
Dry run: when i == 0, then actslice will be searched for expslice[i] which is 'a', it will found at j = 0. i will be incremented and actslice will be searched for expslice[i] which is 'a', it will be found again at j = 0. This seems wrong as j = 0 is already matched with i = 0.
will review it by nov 6th EOD.
@AkashKumar7902 Please resolve the merger conflicts.
Hey @AkashKumar7902 we can have connect offline too if you have any doubts are questions.
actslice = ['a', 'b', 'c', 'c']
I have missed this comment. Will analyse this and reply soon.
Regarding slice error which have mentioned. Yes there is an error . At first we gave a thought that order of elements in slice is not important and we have written that logic although that logic is also false for that useCase. Now we are considering order is important so we can use just use one index and one for loop and write the logic . If you are interested you can create a separate issue on it and work it.
Hi @AkashKumar7902 Please inform me once all the changes are done for review.
Hi @AkashKumar7902 Please inform me once all the changes are done for review.
Hey @charankamarapu, all the changes have been made !
cool will review it by EOD.
do we need to include keploy-config.yaml in .gitignore file ?
In users filebase : No! They may use it in testing step in production or before sending to production
Good work @AkashKumar7902 !
Related Issue
Closes: #1012
Describe the changes you've made
added generate-config command and added support for adding noisy fields in config file.
noisy field example:
============= USAGE============= If the user only wants some of the values of a field to be labelled as noisy, they can provide a corresponding array of regex expression. If an empty array is provided for a key, no matter what the corresponding value is, it would always be ignored as noisy.
Type of change
Please let us know if any test cases are added
Please describe the tests(if any). Provide instructions how its affecting the coverage.
Describe if there is any unusual behaviour of your code(Write
NA
if there isn't)NA
Checklist:
Screenshots (if any)
when i pass a correct regex expression for the Date, it successfully gets ignored:
but when i pass a regex, say "test", it behaves as expected and consider the date value in header as not noisy as it doesn't get matched with "test":