Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix exporter-otlp schema #852

Merged
merged 3 commits into from
Mar 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ telemetry:
- logs
endpoint:
location: http://localhost:4318
overrides:
logs: /v1/logs
bindings:
net0:
type: test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ telemetry:
- metrics
endpoint:
location: http://localhost:4318
overrides:
metrics: /v1/metrics
bindings:
net0:
type: test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,21 @@
"location":
{
"type": "string"
},
"overrides":
{
"type": "object",
"properties":
{
"metrics":
{
"type": "string"
},
"logs":
{
"type": "string"
}
}
}
},
"required":
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
* Copyright 2021-2023 Aklivity Inc
*
* Licensed under the Aklivity Community License (the "License"); you may not use
* this file except in compliance with the License. You may obtain a copy of the
* License at
*
* https://www.aklivity.io/aklivity-community-license/
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*/
package io.aklivity.zilla.runtime.exporter.otlp.internal.config;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.not;
import static org.hamcrest.Matchers.nullValue;

import jakarta.json.JsonObject;

import org.junit.Rule;
import org.junit.Test;

import io.aklivity.zilla.specs.engine.config.ConfigSchemaRule;

public class SchemaTest
{
@Rule
public final ConfigSchemaRule schema = new ConfigSchemaRule()
.schemaPatch("io/aklivity/zilla/specs/exporter/otlp/schema/otlp.schema.patch.json")
.schemaPatch("io/aklivity/zilla/specs/engine/schema/binding/test.schema.patch.json")
.schemaPatch("io/aklivity/zilla/specs/engine/schema/metrics/test.schema.patch.json")
.configurationRoot("io/aklivity/zilla/specs/exporter/otlp/config");

@Test
public void shouldValidateEvent()
{
JsonObject config = schema.validate("event.yaml");

assertThat(config, not(nullValue()));
}

@Test
public void shouldValidateMetrics()
{
JsonObject config = schema.validate("metrics.yaml");

assertThat(config, not(nullValue()));
}
}