Skip to content

[fix][fn] fix broken function-go test - #12

Open
pgier wants to merge 1 commit into
masterfrom
fix-function-go-test
Open

[fix][fn] fix broken function-go test#12
pgier wants to merge 1 commit into
masterfrom
fix-function-go-test

Conversation

@pgier

@pgier pgier commented Mar 12, 2024

Copy link
Copy Markdown
Owner

Upgrade the prometheus client_golang library which changes the format of the metric output to match the current tests.

Motivation

A previous upgrade (apache#20579) to the prometheus client library broke one of the tests because the spacing changes in the serialized metric output. The specifc commit in prometheus that caused this change is here: prometheus/client_golang#955

Version v1.15.1 of the prometheus client lib changes the spacing back to what it was in v1.11.0. However, it seems that this spacing is not consistent between versions, so we may want to make the test more flexible in the future to avoid hitting this issue again in future upgrades.

=== RUN   TestExampleSummaryVec
    stats_test.go:149:
        	Error Trace:	/Users/paulgier/projects/apache/pulsar/pulsar-function-go/pf/stats_test.go:149
        	Error:      	Not equal:
        	            	expected: "name: \"pond_temperature_celsius\"\nhelp: \"The temperature of the frog pond.\"\ntype: SUMMARY\nmetric: {\n  label: {\n    name: \"species\"\n    value: \"leiopelma-hochstetteri\"\n  }\n  summary: {\n    sample_count: 0\n    sample_sum: 0\n    quantile: {\n      quantile: 0.5\n      value: nan\n    }\n    quantile: {\n      quantile: 0.9\n      value: nan\n    }\n    quantile: {\n      quantile: 0.99\n      value: nan\n    }\n  }\n}\nmetric: {\n  label: {\n    name: \"species\"\n    value: \"lithobates-catesbeianus\"\n  }\n  summary: {\n    sample_count: 1000\n    sample_sum: 31956.100000000017\n    quantile: {\n      quantile: 0.5\n      value: 32.4\n    }\n    quantile: {\n      quantile: 0.9\n      value: 41.4\n    }\n    quantile: {\n      quantile: 0.99\n      value: 41.9\n    }\n  }\n}\nmetric: {\n  label: {\n    name: \"species\"\n    value: \"litoria-caerulea\"\n  }\n  summary: {\n    sample_count: 1000\n    sample_sum: 29969.50000000001\n    quantile: {\n      quantile: 0.5\n      value: 31.1\n    }\n    quantile: {\n      quantile: 0.9\n      value: 41.3\n    }\n    quantile: {\n      quantile: 0.99\n      value: 41.9\n    }\n  }\n}\n"
        	            	actual  : "name:  \"pond_temperature_celsius\"\nhelp:  \"The temperature of the frog pond.\"\ntype:  SUMMARY\nmetric:  {\n  label:  {\n    name:  \"species\"\n    value:  \"leiopelma-hochstetteri\"\n  }\n  summary:  {\n    sample_count:  0\n    sample_sum:  0\n    quantile:  {\n      quantile:  0.5\n      value:  nan\n    }\n    quantile:  {\n      quantile:  0.9\n      value:  nan\n    }\n    quantile:  {\n      quantile:  0.99\n      value:  nan\n    }\n  }\n}\nmetric:  {\n  label:  {\n    name:  \"species\"\n    value:  \"lithobates-catesbeianus\"\n  }\n  summary:  {\n    sample_count:  1000\n    sample_sum:  31956.100000000017\n    quantile:  {\n      quantile:  0.5\n      value:  32.4\n    }\n    quantile:  {\n      quantile:  0.9\n      value:  41.4\n    }\n    quantile:  {\n      quantile:  0.99\n      value:  41.9\n    }\n  }\n}\nmetric:  {\n  label:  {\n    name:  \"species\"\n    value:  \"litoria-caerulea\"\n  }\n  summary:  {\n    sample_count:  1000\n    sample_sum:  29969.50000000001\n    quantile:  {\n      quantile:  0.5\n      value:  31.1\n    }\n    quantile:  {\n      quantile:  0.9\n      value:  41.3\n    }\n    quantile:  {\n      quantile:  0.99\n      value:  41.9\n    }\n  }\n}\n"

Modifications

Verifying this change

  • Make sure that the change passes the CI checks.

(Please pick either of the following options)

This change is a trivial rework / code cleanup without any test coverage.

(or)

This change is already covered by existing tests, such as (please describe tests).

(or)

This change added tests and can be verified as follows:

(example:)

  • Added integration tests for end-to-end deployment with large payloads (10MB)
  • Extended integration test for recovery after broker failure

Does this pull request potentially affect one of the following parts:

If the box was checked, please highlight the changes

  • Dependencies (add or upgrade a dependency)
  • The public API
  • The schema
  • The default values of configurations
  • The threading model
  • The binary protocol
  • The REST endpoints
  • The admin CLI options
  • [ X ] The metrics
  • Anything that affects deployment

Documentation

  • doc
  • doc-required
  • [ X ] doc-not-needed
  • doc-complete

Matching PR in forked repository

PR in forked repository:

@pgier pgier changed the title [fix][functions] fix broken function-go test [fix][function] fix broken function-go test Mar 12, 2024
@pgier pgier changed the title [fix][function] fix broken function-go test [fix][fn] fix broken function-go test Mar 12, 2024
@pgier
pgier force-pushed the fix-function-go-test branch from bedc1d5 to d175a63 Compare March 13, 2024 16:06
Upgrade the prometheus client_golang library which changes the format of the metric output
to match the current tests.
@pgier
pgier force-pushed the fix-function-go-test branch from d175a63 to 9c5cf0f Compare March 13, 2024 16:11
@pgier
pgier force-pushed the master branch 2 times, most recently from 29d7835 to 392549c Compare March 13, 2024 16:15
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.

1 participant