From afefb7464ee00494e93ff76ef5d554a9d46c91b0 Mon Sep 17 00:00:00 2001 From: Daniel Jaglowski Date: Fri, 2 Aug 2024 09:05:48 -0500 Subject: [PATCH 1/2] [chore] Add readonly matrix test. Remove invalid mutability assertions (#10632) The primary objective here was to add new test cases for the graph. However, I found that mutability assertions added in #8634 appear to be nondeterministic. Therefore, important test cases cannot be covered with them in place. This effectively removes the assertions about mutability for now. @dmitryax, I'm curious if you have better ideas here. I am thinking that perhaps it would be better to have an entirely separate set of test cases which are focused on mutability expectations. Co-authored-by: Pablo Baeyens --- service/internal/graph/graph_test.go | 77 ++++++++++++++++++++++------ 1 file changed, 61 insertions(+), 16 deletions(-) diff --git a/service/internal/graph/graph_test.go b/service/internal/graph/graph_test.go index e20b85b2961..fcc2ea6cf89 100644 --- a/service/internal/graph/graph_test.go +++ b/service/internal/graph/graph_test.go @@ -569,7 +569,43 @@ func TestConnectorPipelinesGraph(t *testing.T) { expectedPerExporter: 1, }, { - name: "pipelines_conn_matrix.yaml", + name: "pipelines_conn_matrix_immutable.yaml", + pipelineConfigs: pipelines.Config{ + component.MustNewIDWithName("traces", "in"): { + Receivers: []component.ID{component.MustNewID("examplereceiver")}, + Processors: []component.ID{component.MustNewID("exampleprocessor")}, + Exporters: []component.ID{component.MustNewID("exampleconnector")}, + }, + component.MustNewIDWithName("metrics", "in"): { + Receivers: []component.ID{component.MustNewID("examplereceiver")}, + Processors: []component.ID{component.MustNewID("exampleprocessor")}, + Exporters: []component.ID{component.MustNewID("exampleconnector")}, + }, + component.MustNewIDWithName("logs", "in"): { + Receivers: []component.ID{component.MustNewID("examplereceiver")}, + Processors: []component.ID{component.MustNewID("exampleprocessor")}, + Exporters: []component.ID{component.MustNewID("exampleconnector")}, + }, + component.MustNewIDWithName("traces", "out"): { + Receivers: []component.ID{component.MustNewID("exampleconnector")}, + Processors: []component.ID{component.MustNewID("exampleprocessor")}, + Exporters: []component.ID{component.MustNewID("exampleexporter")}, + }, + component.MustNewIDWithName("metrics", "out"): { + Receivers: []component.ID{component.MustNewID("exampleconnector")}, + Processors: []component.ID{component.MustNewID("exampleprocessor")}, + Exporters: []component.ID{component.MustNewID("exampleexporter")}, + }, + component.MustNewIDWithName("logs", "out"): { + Receivers: []component.ID{component.MustNewID("exampleconnector")}, + Processors: []component.ID{component.MustNewID("exampleprocessor")}, + Exporters: []component.ID{component.MustNewID("exampleexporter")}, + }, + }, + expectedPerExporter: 3, + }, + { + name: "pipelines_conn_matrix_mutable.yaml", pipelineConfigs: pipelines.Config{ component.MustNewIDWithName("traces", "in"): { Receivers: []component.ID{component.MustNewID("examplereceiver")}, @@ -949,34 +985,43 @@ func TestConnectorPipelinesGraph(t *testing.T) { for _, e := range allExporters[component.DataTypeTraces] { tracesExporter := e.(*testcomponents.ExampleExporter) assert.Equal(t, test.expectedPerExporter, len(tracesExporter.Traces)) - expected := testdata.GenerateTraces(1) - if len(allExporters[component.DataTypeTraces]) > 1 { - expected.MarkReadOnly() // multiple read-only exporters should get read-only pdata - } + expectedMutable := testdata.GenerateTraces(1) + expectedReadOnly := testdata.GenerateTraces(1) + expectedReadOnly.MarkReadOnly() for i := 0; i < test.expectedPerExporter; i++ { - assert.EqualValues(t, expected, tracesExporter.Traces[i]) + if tracesExporter.Traces[i].IsReadOnly() { + assert.EqualValues(t, expectedReadOnly, tracesExporter.Traces[i]) + } else { + assert.EqualValues(t, expectedMutable, tracesExporter.Traces[i]) + } } } for _, e := range allExporters[component.DataTypeMetrics] { metricsExporter := e.(*testcomponents.ExampleExporter) assert.Equal(t, test.expectedPerExporter, len(metricsExporter.Metrics)) - expected := testdata.GenerateMetrics(1) - if len(allExporters[component.DataTypeMetrics]) > 1 { - expected.MarkReadOnly() // multiple read-only exporters should get read-only pdata - } + expectedMutable := testdata.GenerateMetrics(1) + expectedReadOnly := testdata.GenerateMetrics(1) + expectedReadOnly.MarkReadOnly() for i := 0; i < test.expectedPerExporter; i++ { - assert.EqualValues(t, expected, metricsExporter.Metrics[i]) + if metricsExporter.Metrics[i].IsReadOnly() { + assert.EqualValues(t, expectedReadOnly, metricsExporter.Metrics[i]) + } else { + assert.EqualValues(t, expectedMutable, metricsExporter.Metrics[i]) + } } } for _, e := range allExporters[component.DataTypeLogs] { logsExporter := e.(*testcomponents.ExampleExporter) assert.Equal(t, test.expectedPerExporter, len(logsExporter.Logs)) - expected := testdata.GenerateLogs(1) - if len(allExporters[component.DataTypeLogs]) > 1 { - expected.MarkReadOnly() // multiple read-only exporters should get read-only pdata - } + expectedMutable := testdata.GenerateLogs(1) + expectedReadOnly := testdata.GenerateLogs(1) + expectedReadOnly.MarkReadOnly() for i := 0; i < test.expectedPerExporter; i++ { - assert.EqualValues(t, expected, logsExporter.Logs[i]) + if logsExporter.Logs[i].IsReadOnly() { + assert.EqualValues(t, expectedReadOnly, logsExporter.Logs[i]) + } else { + assert.EqualValues(t, expectedMutable, logsExporter.Logs[i]) + } } } }) From 685625abb4703cb2e45a397f008127bbe2ba4c0e Mon Sep 17 00:00:00 2001 From: Tyler Helmuth <12352919+TylerHelmuth@users.noreply.github.com> Date: Fri, 2 Aug 2024 08:15:28 -0600 Subject: [PATCH 2/2] [chore] remove vmmeter from `build-and-test.yaml` (#10590) These things were added for the [arm build](https://github.com/open-telemetry/opentelemetry-collector/pull/9584) which has been moved to its own job. Fixes https://github.com/open-telemetry/opentelemetry-collector/issues/10587 --- .github/workflows/build-and-test.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 2e6903585f4..55cd469832d 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -145,13 +145,6 @@ jobs: runs-on: ${{ matrix.runner }} needs: [setup-environment] steps: - - name: Set up arkade - uses: alexellis/setup-arkade@b1816384b2260cfd2c023c6798d26075786cfc7f # v3 - - name: Install vmmeter - run: | - sudo -E arkade oci install ghcr.io/openfaasltd/vmmeter:latest --path /usr/local/bin/ - - name: Run vmmeter - uses: self-actuated/vmmeter-action@c7e2162e39294a810cab647cacc215ecd68a44f6 # v1 - name: Checkout Repo uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - name: Setup Go