Skip to content
This repository has been archived by the owner on Oct 9, 2023. It is now read-only.

config: Support converting string configs to []byte #85

Merged
merged 5 commits into from
May 20, 2021

Conversation

EngHabu
Copy link
Contributor

@EngHabu EngHabu commented May 19, 2021

Signed-off-by: Haytham Abuelfutuh [email protected]

TL;DR

Support converting string config values to []byte config fields.

Type

  • Bug Fix
  • Feature
  • Plugin

Are all requirements met?

  • Code completed
  • Smoke tested
  • Unit tests added
  • Code documentation added
  • Any pending items have an associated Issue

@codecov
Copy link

codecov bot commented May 19, 2021

Codecov Report

Merging #85 (c16fc47) into master (fd1a616) will decrease coverage by 7.07%.
The diff coverage is 93.75%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #85      +/-   ##
==========================================
- Coverage   72.61%   65.53%   -7.08%     
==========================================
  Files          57       59       +2     
  Lines        2030     2272     +242     
==========================================
+ Hits         1474     1489      +15     
- Misses        413      640     +227     
  Partials      143      143              
Flag Coverage Δ
unittests 65.53% <93.75%> (-7.08%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
config/viper/viper.go 8.02% <93.75%> (ø)
config/viper/collection.go 0.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fd1a616...c16fc47. Read the comment docs.

katrogan
katrogan previously approved these changes May 19, 2021
EngHabu added 3 commits May 19, 2021 15:33
Signed-off-by: Haytham Abuelfutuh <[email protected]>
Signed-off-by: Haytham Abuelfutuh <[email protected]>
input := 5
res, err := stringToByteArray(reflect.TypeOf(input), reflect.TypeOf([]byte{}), input)
assert.NoError(t, err)
assert.NotEqual(t, []byte("hello"), res)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's the purpose of the not equal test here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess I can make it equal 5, res...

@EngHabu EngHabu merged commit 5bfc472 into master May 20, 2021
eapolinario pushed a commit that referenced this pull request Sep 6, 2023
* config: Support converting string configs to []byte

Signed-off-by: Haytham Abuelfutuh <[email protected]>

* Use base64 encoding to match yaml.unmarshal behavior

Signed-off-by: Haytham Abuelfutuh <[email protected]>

* support string array since it seems mapstructure does that

Signed-off-by: Haytham Abuelfutuh <[email protected]>

* Fix unit test value

Signed-off-by: Haytham Abuelfutuh <[email protected]>

* Increase patch coverage

Signed-off-by: Haytham Abuelfutuh <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants