Skip to content

Commit 4fc1acd

Browse files
authored
Add component doc verificaion script (#299)
1 parent 0601d2e commit 4fc1acd

File tree

9 files changed

+73
-0
lines changed

9 files changed

+73
-0
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
// Copyright The OpenTelemetry Authors
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
package main
15+
16+
import (
17+
"os"
18+
"path/filepath"
19+
"testing"
20+
21+
"github.com/stretchr/testify/require"
22+
"go.opentelemetry.io/collector/component/componentdocs"
23+
)
24+
25+
const (
26+
relativeDefaultComponentsPath = "cmd/otelcontribcol/components.go"
27+
projectGoModule = "github.com/open-telemetry/opentelemetry-collector-contrib"
28+
)
29+
30+
// TestComponentDocs verifies existence of READMEs for components specified as
31+
// default components in the collector. Looking for default components being enabled
32+
// in the collector gives a reasonable measure of the components that need to be
33+
// documented. Note, that for this test to work, the underlying assumption is
34+
// the imports in cmd/otelcontribcol/components.go" are indicative
35+
// of components that require documentation.
36+
func TestComponentDocs(t *testing.T) {
37+
wd, err := os.Getwd()
38+
require.NoError(t, err, "failed to get working directory: %v")
39+
40+
// Absolute path to the project root directory
41+
projectPath := filepath.Join(wd, "../../")
42+
43+
err = componentdocs.VerifyComponentDocumentation(
44+
projectPath,
45+
relativeDefaultComponentsPath,
46+
projectGoModule,
47+
)
48+
require.NoError(t, err)
49+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Azure Monitor Exporter
2+
3+
To be added.

exporter/carbonexporter/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Carbon Exporter
2+
3+
To be added.

exporter/kinesisexporter/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Kinesis Exporter
2+
3+
To be added.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Stackdriver Exporter
2+
3+
To be added.

receiver/carbonreceiver/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Carbon Receiver
2+
3+
To be added.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Jaeger Receiver
2+
3+
To be added.

receiver/wavefrontreceiver/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Wavefront Receiver
2+
3+
To be added.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Zipkin Receiver
2+
3+
To be added.

0 commit comments

Comments
 (0)