-
Notifications
You must be signed in to change notification settings - Fork 51
rw2sender-fix: Add Makefile; clean README and CI #210
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
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,21 +1,21 @@ | ||
| name: Compliance Tests | ||
|
|
||
| --- | ||
| name: Compliance | ||
| on: | ||
| pull_request: | ||
| push: | ||
| branches: [main] | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| remotewrite-compliance: | ||
| remotewrite-sender: | ||
| name: Remote Write Sender | ||
| runs-on: ubuntu-latest | ||
|
|
||
| container: | ||
| image: quay.io/prometheus/golang-builder:1.25-base | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Go | ||
| uses: actions/setup-go@v4 | ||
| with: | ||
| go-version: '1.22' | ||
|
|
||
| - name: Run Remote Write Prometheus Compliance Tests | ||
| run: | | ||
| cd remotewrite/sender | ||
| go test --tags=compliance -run "TestRemoteWrite/prometheus/.+" -v ./ | ||
| - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | ||
| with: | ||
| persist-credentials: false | ||
| - run: cd remotewrite && make sender |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| results.json | ||
| config.yml | ||
| index.preloaded.html | ||
| bin/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| # Set the default target to 'help' so it runs when you just type 'make' | ||
| .DEFAULT_GOAL := help | ||
|
|
||
| mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST))) | ||
| current_dir := $(notdir $(patsubst %/,%,$(dir $(mkfile_path)))) | ||
| ROOT_DIR := $(dir $(mkfile_path)) | ||
|
|
||
| SED=$(shell which gsed 2>/dev/null || which sed) | ||
|
|
||
| # Shared variables | ||
| DEBUG="" | ||
| TIMEOUT="10m" | ||
| PROMETHEUS_RW_COMPLIANCE_TEST_RE="" | ||
| PROMETHEUS_RW_COMPLIANCE_SKIP_TEST_RE="" | ||
| RESULT_FILE="$(ROOT_DIR)/results.json" | ||
|
|
||
| # Go test arguments and the base execution command. | ||
| BASE_TEST_ARGS = -run $(PROMETHEUS_RW_COMPLIANCE_TEST_RE) -skip $(PROMETHEUS_RW_COMPLIANCE_SKIP_TEST_RE) | ||
| RUN_TEST = cd ./$(COMPONENT) && DEBUG=$(DEBUG) $(COMPONENT_ENV) go test $(BASE_TEST_ARGS) | ||
|
|
||
| # Use target-specific variables to dynamically inject directories and environment variables. | ||
| sender sender-%: PROMETHEUS_COMPLIANCE_RW_SENDERS="prometheus" | ||
| sender sender-%: COMPONENT = sender | ||
| sender sender-%: COMPONENT_ENV = PROMETHEUS_COMPLIANCE_RW_SENDERS=$(PROMETHEUS_COMPLIANCE_RW_SENDERS) | ||
|
|
||
| receiver receiver-%: COMPONENT = receiver | ||
| receiver receiver-%: COMPONENT_ENV = PROMETHEUS_RW2_COMPLIANCE_RECEIVERS=$(PROMETHEUS_RW2_COMPLIANCE_RECEIVERS) | ||
|
|
||
| .PHONY: help | ||
| help: ## Show this help message | ||
| @echo "Usage: make [target]" | ||
| @echo "" | ||
| @echo "Available commands:" | ||
| @awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf " \033[36m%-15s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST) | ||
|
|
||
| .PHONY: sender | ||
| sender: ## Run sender compliance tests for a given senders suitable for humans and CI. | ||
| $(RUN_TEST) -v -timeout=$(TIMEOUT) | ||
|
|
||
| .PHONY: sender-web | ||
| sender-web: ## Run sender compliance tests for a given senders with a HTML results view. | ||
| @$(RUN_TEST) -json | tee $(RESULT_FILE) | ||
| @$(MAKE) results-web | ||
|
|
||
| .PHONY: receiver | ||
| receiver: ## Run receiver compliance tests for a given receivers suitable for humans and CI. | ||
| $(RUN_TEST) -v -timeout=$(TIMEOUT) | ||
|
|
||
| .PHONY: receiver-web | ||
| receiver-web: ## Run receiver compliance tests for a given receivers with a HTML results view. | ||
| @$(RUN_TEST) -json | tee $(RESULT_FILE) | ||
| @$(MAKE) results-web | ||
|
|
||
| .PHONY: results-web | ||
| results-web: ## Generate HTML view with ./results.json from the index.html file and open in your browser. We re-generate HTML file to avoid CORS issue on secure browsers. | ||
| @cat index.html | perl -pe 'BEGIN{local $$/; open(F,"<results.json"); $$c=<F>; close F} s/const PRELOADED_RESULT_DATA = ``;/const PRELOADED_RESULT_DATA = `$$c`;/' > index.preloaded.html | ||
| @open index.preloaded.html | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.