Skip to content

Commit

Permalink
kbs_protocol: skip RCAR client tests when ProtocolVersion error occurs
Browse files Browse the repository at this point in the history
The current setup with trustee repo for KBS server and guest-components
repo for kbs_protocol client code has a cyclic dependency problem.

test_client test uses "KBS latest" container image which won't work if
any RCAR client code changes that change the protocol semantics are made.

The suggested approach to break the cyclic dependency is to get the RCAR
client changes merged first with a KBS protocol version bump. The
RCAR client test is modified to skip the checks in case the "KBS
latest" server returns ProtocolVersion error.

Following this, the corresponding KBS server changes are made in trustee
repo with an update to both kbs_protocol for kbs-client builds and the
server supported protocol version.

Signed-off-by: Mikko Ylinen <[email protected]>
  • Loading branch information
mythi committed Aug 1, 2024
1 parent 58e95d2 commit 1dea00e
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions attestation-agent/kbs_protocol/src/client/rcar_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -354,10 +354,19 @@ mod test {
.try_into()
.expect("resource uri");

let resource = client
.get_resource(resource_uri)
.await
.expect("get resource");
let resource = match client.get_resource(resource_uri).await {
Ok(resource) => resource,
Err(e) => {
// Skip the test if the kbs server returned ProtocolVersion error. Any other
// error is treated as a failure.
assert!(e
.to_string()
.contains("KBS Client Protocol Version Mismatch"));
println!("NOTE: the test is skipped due to KBS protocol incompatibility.");
return ();
}
};

assert_eq!(resource, CONTENT);

let (token, key) = client.get_token().await.expect("get token");
Expand Down

0 comments on commit 1dea00e

Please sign in to comment.