Skip to content

Commit 3fb5a9c

Browse files
authored
Add tests to verify links in documentation (#551)
1 parent 3857c80 commit 3fb5a9c

File tree

12 files changed

+450
-89
lines changed

12 files changed

+450
-89
lines changed

.github/workflows/build.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,10 @@ jobs:
118118
shell: bash
119119
run: make test-all
120120

121+
- name: Doc Tests
122+
shell: bash
123+
run: make test-docs
124+
121125
- name: E2E Local Tests
122126
shell: bash
123127
run: make e2e-local-test

Makefile

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -591,9 +591,9 @@ api/v1/zz_generated.deepcopy.go: $(API_GO_FILES) controller-gen
591591
.PHONY: api-doc-gen
592592
api-doc-gen: docs/about/04_coherence_spec.adoc ## Generate API documentation
593593

594-
docs/about/04_coherence_spec.adoc: $(API_GO_FILES)
594+
docs/about/04_coherence_spec.adoc: $(API_GO_FILES) utils/docgen/main.go
595595
@echo "Generating CRD Doc"
596-
go run ./docgen/ \
596+
go run ./utils/docgen/ \
597597
api/v1/coherenceresourcespec_types.go \
598598
api/v1/coherence_types.go \
599599
api/v1/coherenceresource_types.go \
@@ -1981,7 +1981,7 @@ version:
19811981
# Build the documentation.
19821982
# ----------------------------------------------------------------------------------------------------------------------
19831983
.PHONY: docs
1984-
docs:
1984+
docs: api-doc-gen
19851985
./mvnw -B -f java install -P docs -pl docs -DskipTests \
19861986
-Doperator.version=$(VERSION) \
19871987
-Doperator.image=$(OPERATOR_IMAGE) \
@@ -1991,6 +1991,21 @@ docs:
19911991
cp -R docs/images/* build/_output/docs/images/
19921992
find examples/ -name \*.png -exec cp {} build/_output/docs/images/images/ \;
19931993

1994+
# ----------------------------------------------------------------------------------------------------------------------
1995+
# Test the documentation.
1996+
# ----------------------------------------------------------------------------------------------------------------------
1997+
.PHONY: test-docs
1998+
test-docs: docs
1999+
go run ./utils/linkcheck/ --file $(BUILD_OUTPUT)/docs/pages/... \
2000+
--exclude 'https://oracle.github.io/coherence-operator/charts' \
2001+
--exclude 'https://github.com/oracle/coherence-operator/releases' \
2002+
--exclude 'https://oracle.github.io/coherence-operator/docs/latest/' \
2003+
--exclude 'http://proxyserver' \
2004+
--exclude 'http://<pod-ip' \
2005+
--exclude 'http://elasticsearch-master' \
2006+
--exclude 'http://payments' \
2007+
2>&1 | tee $(TEST_LOGS_DIR)/doc-link-check.log
2008+
19942009
# ----------------------------------------------------------------------------------------------------------------------
19952010
# Start a local web server to serve the documentation.
19962011
# ----------------------------------------------------------------------------------------------------------------------

api/v1/coherence_types.go

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1162,83 +1162,83 @@ type ServiceMonitorSpec struct {
11621162
// +optional
11631163
Labels map[string]string `json:"labels,omitempty"`
11641164
// The label to use to retrieve the job name from.
1165-
// See https://coreos.com/operators/prometheus/docs/latest/api.html#servicemonitorspec
1165+
// See https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api.md#servicemonitorspec
11661166
// +optional
11671167
JobLabel string `json:"jobLabel,omitempty"`
11681168
// TargetLabels transfers labels on the Kubernetes Service onto the target.
1169-
// See https://coreos.com/operators/prometheus/docs/latest/api.html#servicemonitorspec
1169+
// See https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api.md#servicemonitorspec
11701170
// +listType=atomic
11711171
// +optional
11721172
TargetLabels []string `json:"targetLabels,omitempty"`
11731173
// PodTargetLabels transfers labels on the Kubernetes Pod onto the target.
1174-
// See https://coreos.com/operators/prometheus/docs/latest/api.html#servicemonitorspec
1174+
// See https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api.md#servicemonitorspec
11751175
// +listType=atomic
11761176
// +optional
11771177
PodTargetLabels []string `json:"podTargetLabels,omitempty"`
11781178
// SampleLimit defines per-scrape limit on number of scraped samples that will be accepted.
1179-
// See https://coreos.com/operators/prometheus/docs/latest/api.html#servicemonitorspec
1179+
// See https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api.md#servicemonitorspec
11801180
// +optional
11811181
SampleLimit uint64 `json:"sampleLimit,omitempty"`
11821182
// HTTP path to scrape for metrics.
1183-
// See https://coreos.com/operators/prometheus/docs/latest/api.html#endpoint
1183+
// See https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api.md#endpoint
11841184
// +optional
11851185
Path string `json:"path,omitempty"`
11861186
// HTTP scheme to use for scraping.
1187-
// See https://coreos.com/operators/prometheus/docs/latest/api.html#endpoint
1187+
// See https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api.md#endpoint
11881188
// +optional
11891189
Scheme string `json:"scheme,omitempty"`
11901190
// Optional HTTP URL parameters
1191-
// See https://coreos.com/operators/prometheus/docs/latest/api.html#endpoint
1191+
// See https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api.md#endpoint
11921192
// +optional
11931193
Params map[string][]string `json:"params,omitempty"`
11941194
// Interval at which metrics should be scraped
1195-
// See https://coreos.com/operators/prometheus/docs/latest/api.html#endpoint
1195+
// See https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api.md#endpoint
11961196
// +optional
11971197
Interval monitoringv1.Duration `json:"interval,omitempty"`
11981198
// Timeout after which the scrape is ended
1199-
// See https://coreos.com/operators/prometheus/docs/latest/api.html#endpoint
1199+
// See https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api.md#endpoint
12001200
// +optional
12011201
ScrapeTimeout monitoringv1.Duration `json:"scrapeTimeout,omitempty"`
12021202
// TLS configuration to use when scraping the endpoint
1203-
// See https://coreos.com/operators/prometheus/docs/latest/api.html#endpoint
1203+
// See https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api.md#endpoint
12041204
// +optional
12051205
TLSConfig *monitoringv1.TLSConfig `json:"tlsConfig,omitempty"`
12061206
// File to read bearer token for scraping targets.
1207-
// See https://coreos.com/operators/prometheus/docs/latest/api.html#endpoint
1207+
// See https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api.md#endpoint
12081208
// +optional
12091209
BearerTokenFile string `json:"bearerTokenFile,omitempty"`
12101210
// Secret to mount to read bearer token for scraping targets. The secret
12111211
// needs to be in the same namespace as the service monitor and accessible by
12121212
// the Prometheus Operator.
1213-
// See https://coreos.com/operators/prometheus/docs/latest/api.html#endpoint
1213+
// See https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api.md#endpoint
12141214
// +optional
12151215
BearerTokenSecret corev1.SecretKeySelector `json:"bearerTokenSecret,omitempty"`
12161216
// HonorLabels chooses the metric labels on collisions with target labels.
1217-
// See https://coreos.com/operators/prometheus/docs/latest/api.html#endpoint
1217+
// See https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api.md#endpoint
12181218
// +optional
12191219
HonorLabels bool `json:"honorLabels,omitempty"`
12201220
// HonorTimestamps controls whether Prometheus respects the timestamps present in scraped data.
1221-
// See https://coreos.com/operators/prometheus/docs/latest/api.html#endpoint
1221+
// See https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api.md#endpoint
12221222
// +optional
12231223
HonorTimestamps *bool `json:"honorTimestamps,omitempty"`
12241224
// BasicAuth allow an endpoint to authenticate over basic authentication
12251225
// More info: https://prometheus.io/docs/operating/configuration/#endpoints
1226-
// See https://coreos.com/operators/prometheus/docs/latest/api.html#endpoint
1226+
// See https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api.md#endpoint
12271227
// +optional
12281228
BasicAuth *monitoringv1.BasicAuth `json:"basicAuth,omitempty"`
12291229
// MetricRelabelings to apply to samples before ingestion.
1230-
// See https://coreos.com/operators/prometheus/docs/latest/api.html#endpoint
1230+
// See https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api.md#endpoint
12311231
// +listType=atomic
12321232
// +optional
12331233
MetricRelabelings []*monitoringv1.RelabelConfig `json:"metricRelabelings,omitempty"`
12341234
// Relabelings to apply to samples before scraping.
12351235
// More info: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#relabel_config
1236-
// See https://coreos.com/operators/prometheus/docs/latest/api.html#endpoint
1236+
// See https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api.md#endpoint
12371237
// +listType=atomic
12381238
// +optional
12391239
Relabelings []*monitoringv1.RelabelConfig `json:"relabelings,omitempty"`
12401240
// ProxyURL eg http://proxyserver:2195 Directs scrapes to proxy through this endpoint.
1241-
// See https://coreos.com/operators/prometheus/docs/latest/api.html#endpoint
1241+
// See https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api.md#endpoint
12421242
// +optional
12431243
ProxyURL *string `json:"proxyURL,omitempty"`
12441244
}
@@ -1805,7 +1805,6 @@ type ServiceSpec struct {
18051805
// If specified and supported by the platform, this will restrict traffic through the cloud-provider
18061806
// load-balancer will be restricted to the specified client IPs. This field will be ignored if the
18071807
// cloud-provider does not support the feature."
1808-
// More info: https://kubernetes.io/docs/tasks/access-application-cluster/configure-cloud-provider-firewall/
18091808
// +listType=atomic
18101809
// +optional
18111810
LoadBalancerSourceRanges []string `json:"loadBalancerSourceRanges,omitempty"`

0 commit comments

Comments
 (0)