Skip to content
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

chore(tests) split out plugin map test #316

Merged
merged 2 commits into from
Apr 24, 2023
Merged

Conversation

rainest
Copy link
Contributor

@rainest rainest commented Apr 17, 2023

Separate the plugin arbitrary map default test from the main default test. The new test only checks the arbitrary map field.

Changes to the test plugin in upstream Kong break the blanket diff used in the main test, and would require a version split without testing only the relevant field.

The issue appeared in https://github.com/Kong/go-kong/actions/runs/4718806033/jobs/8369120871?pr=315

 === RUN   TestFillPluginDefaults/nested_config_with_arbitrary_map_field
    plugin_service_test.go:706:   &kong.Plugin{
          	... // 5 identical fields
          	Service:  nil,
          	Consumer: nil,
          	Config: kong.Configuration{
          		"content_type":         string("application/json"),
          		"custom_fields_by_lua": map[string]any{"foo": string("bar")},
        - 		"flush_timeout":        nil,
        + 		"flush_timeout":        float64(2),
          		"headers":              nil,
          		"http_endpoint":        nil,
          		"keepalive":            float64(60000),
          		"method":               string("POST"),
        - 		"queue": map[string]any{
        - 			"initial_retry_delay":  float64(0.01),
        - 			"max_batch_size":       float64(1),
        - 			"max_bytes":            nil,
        - 			"max_coalescing_delay": float64(1),
        - 			"max_entries":          float64(10000),
        - 			"max_retry_delay":      float64(60),
        - 			"max_retry_time":       float64(60),
        - 			"name":                 nil,
        - 		},
        - 		"queue_size":  nil,
        + 		"queue_size":  float64(1),
        - 		"retry_count": nil,
        + 		"retry_count": float64(10),
          		"timeout":     float64(10000),
          	},
          	Enabled: &false,
          	RunOn:   nil,
          	... // 3 identical fields
          }
--- FAIL: TestFillPluginDefaults (0.04s)

These fields were added upstream for 3.3: Kong/kong@9df893f

@rainest rainest requested a review from a team as a code owner April 17, 2023 18:49
@codecov-commenter
Copy link

Codecov Report

Patch and project coverage have no change.

Comparison is base (9458342) 52.73% compared to head (f7d9ae1) 52.73%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #316   +/-   ##
=======================================
  Coverage   52.73%   52.73%           
=======================================
  Files          68       68           
  Lines        5012     5012           
=======================================
  Hits         2643     2643           
  Misses       1798     1798           
  Partials      571      571           
Flag Coverage Δ
2.1.4 35.87% <ø> (ø)
2.2.1.3 46.52% <ø> (ø)
2.2.2 16.75% <ø> (-19.12%) ⬇️
2.3.3 35.55% <ø> (-0.48%) ⬇️
2.3.3.4 47.20% <ø> (ø)
2.4.1 36.11% <ø> (ø)
2.4.1.3 47.28% <ø> (+0.07%) ⬆️
2.5.1.2 47.28% <ø> (+0.07%) ⬆️
2.5.2 36.11% <ø> (ø)
2.6.1 36.11% <ø> (ø)
2.6.1.0 47.28% <ø> (+0.07%) ⬆️
2.7.2 36.11% <ø> (ø)
2.7.2.0 48.84% <ø> (+0.07%) ⬆️
2.8.3 36.11% <ø> (ø)
2.8.4.0 48.84% <ø> (+0.07%) ⬆️
3.0.2 35.55% <ø> (ø)
3.0.2.0 49.30% <ø> (+0.07%) ⬆️
3.1.1 37.07% <ø> (ø)
3.1.1.3 50.91% <ø> (+0.07%) ⬆️
3.2.2 37.13% <ø> (ø)
3.2.2.1 50.91% <ø> (+0.07%) ⬆️
community 37.68% <ø> (ø)
enterprise 51.47% <ø> (+0.07%) ⬆️
enterprise-nightly 50.91% <ø> (+0.07%) ⬆️
integration 52.73% <ø> (ø)
nightly 37.13% <ø> (ø)

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

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

kong/plugin_service_test.go Outdated Show resolved Hide resolved
kong/plugin_service_test.go Outdated Show resolved Hide resolved
kong/plugin_service_test.go Show resolved Hide resolved
Separate the plugin arbitrary map default test from the main default
test. The new test only checks the arbitrary map field.

Changes to the test plugin in upstream Kong break the
blanket diff used in the main test, and would require a version split
without testing only the relevant field.
@pmalek
Copy link
Member

pmalek commented Apr 21, 2023

I've pushed the change to use require and assert based on correct (subtest's) *testing.T.

@czeslavo
Copy link
Contributor

I allow myself to merge this - it unblocks PRs to main.

@czeslavo czeslavo merged commit be56889 into main Apr 24, 2023
@czeslavo czeslavo deleted the chore/plugin-version-compat branch April 24, 2023 11:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants