Radish alpha
r
rad:z3qg5TKmN83afz2fj9z3fQjU8vaYE
Radicle CI adapter for native CI
Radicle
Git
tests: add TEMPORARY workaround for incompatible heartwood change
Merged liw opened 1 year ago

This needs to be removed once the native CI adapter can depend on a newer heartwood, but for now, this allows tests to pass.

Signed-off-by: Lars Wirzenius liw@liw.fi

feat: log request message to run log

Signed-off-by: Lars Wirzenius liw@liw.fi

2 files changed +19 -1 cae775ca 7e4a7610
modified src/runlog.rs
@@ -6,7 +6,7 @@ use std::{
use html_page::{Document, Element, Tag};
use time::{macros::format_description, OffsetDateTime};

-
use radicle_ci_broker::msg::{Oid, RepoId};
+
use radicle_ci_broker::msg::{Oid, RepoId, Request};

use crate::{
    run::RUNSPEC_PATH,
@@ -17,6 +17,7 @@ use crate::{
pub struct RunLog {
    filename: PathBuf,
    title: Option<String>,
+
    request: Option<Request>,
    rid: Option<RepoId>,
    repo_name: Option<String>,
    commit: Option<Oid>,
@@ -147,6 +148,11 @@ impl RunLog {
        );
        doc.push_to_body(ul);

+
        doc.push_to_body(Element::new(Tag::H2).with_text("Request message"));
+
        let req = serde_json::to_string_pretty(&self.request).unwrap();
+
        let req = Element::new(Tag::Pre).with_text(&req);
+
        doc.push_to_body(req);
+

        if let Some(e) = &self.runspec_error {
            let error = Element::new(Tag::P)
                .with_text("Failed to load .radicle/native.yaml: ")
modified tests/integration.rs
@@ -469,6 +469,18 @@ impl Rad {

    fn auth(&self) -> Result<(), std::io::Error> {
        self._rad(&["auth", "--alias=test-node"], &self.home)?;
+

+
        // FIXME: this is a temporary workaround for rad on the system
+
        // using a newer heartwood than what radicle-native-ci is
+
        // using, and there being a config entry that has changed.
+
        // This hack should be removed once the native CI adapter is
+
        // using a newer heartwood.
+
        let filename = self.home.join("config.json");
+
        let config = std::fs::read(&filename).unwrap();
+
        let config = String::from_utf8_lossy(&config);
+
        let config = config.replace(r#""relay": "auto","#, r#""relay": false,"#);
+
        std::fs::write(&filename, config.as_bytes()).unwrap();
+

        Ok(())
    }