Skip to content
This repository has been archived by the owner on Nov 19, 2020. It is now read-only.

Test back-end with CircleCI #36

Merged
merged 2 commits into from
Oct 29, 2019
Merged

Test back-end with CircleCI #36

merged 2 commits into from
Oct 29, 2019

Conversation

aknuds1
Copy link
Contributor

@aknuds1 aknuds1 commented Oct 28, 2019

Change CircleCI configuration to also test back-end. Fixes #2.

I had to modify a test case that would fail, could use feedback on whether my change is correct.

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
@aknuds1 aknuds1 marked this pull request as ready for review October 28, 2019 18:48
working_directory: ~/plugin
steps:
- checkout
- restore_cache:
keys:
- yarn-packages-{{ checksum "yarn.lock" }}
- run:
name: Install yarn and Go
name: Install node and yarn
Copy link
Contributor Author

Choose a reason for hiding this comment

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

AFAICT, the step doesn't install Go.

@@ -53,15 +53,15 @@ jobs:
- ci
build_backend:
docker:
- image: circleci/golang:1.12
- image: circleci/golang:1.13
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 it's better to upgrade to latest Go?

@@ -65,7 +65,7 @@ func parseRule(rule string) (time.Duration, error) {
func (s Series) Resample(rule string, downsampler string, upsampler string, tr grafana.TimeRange) (Series, error) {
interval, err := parseRule(rule)
if err != nil {
return s, fmt.Errorf(`failed to parse "rule" field "%v": %v`, rule, err)
return s, fmt.Errorf(`failed to parse "rule" field %q: %w`, rule, err)
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 think it's better to wrap the originating error than to just include the message.

@@ -26,7 +26,7 @@ func TestResampleSeries(t *testing.T) {
upsampler: "fillna",
timeRange: grafana.TimeRange{
From: time.Unix(0, 0),
To: time.Unix(11, 0),
To: time.Unix(4, 0),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This triggers the error condition the test case is for. I need feedback though from someone with more domain knowledge on whether it's correct or not. @kylebrandt?

Copy link

@papagian papagian Oct 29, 2019

Choose a reason for hiding this comment

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

This fix seems correct. I wonder how we hadn't caught this before.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks @papagian.

Copy link
Contributor

@kylebrandt kylebrandt left a comment

Choose a reason for hiding this comment

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

Thanks, yay tests!

@aknuds1 aknuds1 merged commit 4e4dda9 into master Oct 29, 2019
@aknuds1 aknuds1 deleted the chore/circleci-tests branch October 29, 2019 14:06
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.

CircleCI to run Go tests
3 participants