Skip to content

Commit fd8ecd7

Browse files
authored
Set-up basic CI with GH actions (#6)
* CI that runs golangci-lint and unit tests in a GitHub action * Fix defects in unit tests for templated generator
1 parent b9e5c10 commit fd8ecd7

File tree

2 files changed

+28
-3
lines changed

2 files changed

+28
-3
lines changed

.github/workflows/lint-test.yml

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Lint and Test
2+
3+
on: [push]
4+
5+
jobs:
6+
lint-and-test:
7+
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v3
11+
12+
- name: Set-up Go
13+
uses: actions/setup-go@v3
14+
with:
15+
go-version: ^1.18
16+
cache: true
17+
18+
- name: Lint
19+
uses: golangci/golangci-lint-action@v3
20+
with:
21+
version: v1.50.1
22+
args: --config ./golangci.yml
23+
24+
- name: Test
25+
run: make test

pkg/tracegen/templated_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212
const testRounds = 5
1313

1414
func TestTemplatedGenerator_Traces(t *testing.T) {
15-
attributeSemantics := []OTelSemantics{SemanticsNone, SemanticsHTTP}
15+
attributeSemantics := []OTelSemantics{SemanticsHTTP}
1616
template := TraceTemplate{
1717
Defaults: SpanDefaults{
1818
Attributes: map[string]interface{}{"fixed.attr": "some-value"},
@@ -27,7 +27,7 @@ func TestTemplatedGenerator_Traces(t *testing.T) {
2727
}
2828

2929
for _, semantics := range attributeSemantics {
30-
template.Defaults.AttributeSemantics = semantics
30+
template.Defaults.AttributeSemantics = &semantics
3131
gen, err := NewTemplatedGenerator(&template)
3232
assert.NoError(t, err)
3333

@@ -43,7 +43,7 @@ func TestTemplatedGenerator_Traces(t *testing.T) {
4343
}
4444
if span.Kind() != ptrace.SpanKindInternal {
4545
assert.GreaterOrEqual(t, attributesWithPrefix(span, "net."), 3)
46-
if template.Defaults.AttributeSemantics == SemanticsHTTP {
46+
if *template.Defaults.AttributeSemantics == SemanticsHTTP {
4747
assert.GreaterOrEqual(t, attributesWithPrefix(span, "http."), 5)
4848
}
4949
}

0 commit comments

Comments
 (0)