Skip to content
This repository was archived by the owner on Dec 18, 2024. It is now read-only.

Commit 1d2db2b

Browse files
committed
Fix CI regression
Fixes two problems - Previous test config requires nightly, so an error is received if "stable" does not happen to be "nightly" as well - We anyway did not provide enough arguments, but no error was given Solution is to just run coverage and remove the JSON report format. Everything is anyhow present in log. Also fixing rust code so tests pass and errors make test fail
1 parent 4728f64 commit 1d2db2b

File tree

5 files changed

+41
-44
lines changed

5 files changed

+41
-44
lines changed

.github/workflows/kuksa_databroker_build.yml

+4-22
Original file line numberDiff line numberDiff line change
@@ -78,31 +78,13 @@ jobs:
7878
crate: cargo-strip
7979
version: latest
8080

81-
- uses: actions-rs/install@v0.1
82-
with:
83-
crate: cargo2junit
84-
version: latest
85-
86-
- name: Run Tests
81+
- name: Show toolchain information
8782
working-directory: ${{github.workspace}}
8883
run: |
89-
cargo test --all-targets -- -Z unstable-options --report-time --format json | cargo2junit > results.xml;
90-
91-
# - name: Publish test results as PR comment
92-
# uses: EnricoMi/publish-unit-test-result-action@v1
93-
# if: github.event_name == 'pull_request'
94-
# with:
95-
# check_name: Test Results
96-
# github_token: ${{ secrets.GITHUB_TOKEN }}
97-
# files: results.xml
98-
99-
- name: Upload testing report
100-
uses: actions/upload-artifact@v3
101-
with:
102-
name: Unit test results
103-
path: results.xml
84+
rustup toolchain list
85+
cargo --version
10486
105-
- name: Run code coverage
87+
- name: Run tests and report code coverage
10688
run: |
10789
cargo tarpaulin -o Xml
10890

kuksa_databroker/databroker/src/grpc/kuksa_val_v1/val.rs

+1-6
Original file line numberDiff line numberDiff line change
@@ -520,11 +520,6 @@ impl broker::EntryUpdate {
520520
entry: &proto::DataEntry,
521521
fields: HashSet<proto::Field>,
522522
) -> Self {
523-
let path = if fields.contains(&proto::Field::Path) {
524-
Some(entry.path.clone())
525-
} else {
526-
None
527-
};
528523
let datapoint = if fields.contains(&proto::Field::Value) {
529524
entry
530525
.value
@@ -542,7 +537,7 @@ impl broker::EntryUpdate {
542537
None
543538
};
544539
Self {
545-
path,
540+
path: None,
546541
datapoint,
547542
actuator_target,
548543
entry_type: None,

kuksa_databroker/databroker/src/grpc/server.rs

+15-5
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ where
152152
pub async fn serve_with_incoming_shutdown<F>(
153153
stream: TcpListenerStream,
154154
broker: broker::DataBroker,
155+
authorization: Authorization,
155156
signal: F,
156157
) -> Result<(), Box<dyn std::error::Error>>
157158
where
@@ -162,13 +163,22 @@ where
162163
Server::builder()
163164
.http2_keepalive_interval(Some(Duration::from_secs(10)))
164165
.http2_keepalive_timeout(Some(Duration::from_secs(20)))
165-
.add_service(sdv::databroker::v1::broker_server::BrokerServer::new(
166-
broker.clone(),
167-
))
168-
.add_service(sdv::databroker::v1::collector_server::CollectorServer::new(
166+
.add_service(
167+
sdv::databroker::v1::broker_server::BrokerServer::with_interceptor(
168+
broker.clone(),
169+
authorization.clone(),
170+
),
171+
)
172+
.add_service(
173+
sdv::databroker::v1::collector_server::CollectorServer::with_interceptor(
174+
broker.clone(),
175+
authorization.clone(),
176+
),
177+
)
178+
.add_service(kuksa::val::v1::val_server::ValServer::with_interceptor(
169179
broker.clone(),
180+
authorization,
170181
))
171-
.add_service(kuksa::val::v1::val_server::ValServer::new(broker.clone()))
172182
.serve_with_incoming_shutdown(stream, shutdown(broker, signal))
173183
.await?;
174184

kuksa_databroker/databroker/tests/current_values.rs

+18-9
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,23 @@
1+
/********************************************************************************
2+
* Copyright (c) 2023 Contributors to the Eclipse Foundation
3+
*
4+
* See the NOTICE file(s) distributed with this work for additional
5+
* information regarding copyright ownership.
6+
*
7+
* This program and the accompanying materials are made available under the
8+
* terms of the Apache License 2.0 which is available at
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* SPDX-License-Identifier: Apache-2.0
12+
********************************************************************************/
13+
114
use core::panic;
215
use std::{future, time::SystemTime, vec};
316

417
use cucumber::{cli, given, then, when, writer, World as _};
518
use databroker_proto::kuksa::val::v1::{
6-
datapoint::Value, DataEntry, DataType, Datapoint, EntryRequest, EntryType, EntryUpdate, Field,
7-
GetRequest, Metadata, SetRequest, View,
19+
datapoint::Value, DataEntry, DataType, Datapoint, EntryRequest, EntryUpdate, Field, GetRequest,
20+
SetRequest, View,
821
};
922
use tracing::debug;
1023
use world::DataBrokerWorld;
@@ -51,11 +64,7 @@ async fn set_current_value(
5164
path: path.clone(),
5265
value: Some(datapoint),
5366
actuator_target: None,
54-
metadata: Some(Metadata {
55-
data_type: data_type.into(),
56-
entry_type: EntryType::Sensor.into(),
57-
..Default::default()
58-
}),
67+
metadata: None,
5968
}),
6069
fields: vec![Field::Value.into(), Field::Path.into()],
6170
}],
@@ -158,7 +167,7 @@ fn assert_set_request_failure(w: &mut DataBrokerWorld, path: String, expected_er
158167

159168
#[tokio::main]
160169
async fn main() {
161-
databroker::init_logging();
170+
// databroker::init_logging();
162171

163172
let opts = cli::Opts::<_, _, _, world::UnsupportedLibtestArgs>::parsed();
164173

@@ -171,6 +180,6 @@ async fn main() {
171180
}
172181
Box::pin(future::ready(()))
173182
})
174-
.run("tests/features/current_values.feature")
183+
.run_and_exit("tests/features/current_values.feature")
175184
.await;
176185
}

kuksa_databroker/databroker/tests/world/mod.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,9 @@ const DATAPOINTS: &[(
108108
#[derive(clap::Args)] // re-export of `clap::Args`
109109
pub struct UnsupportedLibtestArgs {
110110
#[arg(long)]
111-
report_time: bool,
111+
report_time: Option<bool>,
112112
#[arg(long)]
113-
test_threads: u16,
113+
test_threads: Option<u16>,
114114
}
115115

116116
#[derive(Debug)]
@@ -195,6 +195,7 @@ impl DataBrokerWorld {
195195
grpc::server::serve_with_incoming_shutdown(
196196
tokio_stream::wrappers::TcpListenerStream::new(listener),
197197
data_broker,
198+
grpc::server::Authorization::Disabled,
198199
poll_fn(|cx| {
199200
let mut state = owned_state
200201
.lock()

0 commit comments

Comments
 (0)