mirror of
https://github.com/ostreedev/ostree.git
synced 2025-01-06 17:18:25 +03:00
Merge pull request #2303 from cgwalters/gh-actions
ci: Add a Github Action for Rust for tests/inst
This commit is contained in:
commit
236a5ca9bf
27
.github/workflows/tests.yml
vendored
Normal file
27
.github/workflows/tests.yml
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
---
|
||||
name: Rust
|
||||
on:
|
||||
push:
|
||||
branches: [master]
|
||||
pull_request:
|
||||
branches: [master]
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
ACTIONS_LINTS_TOOLCHAIN: 1.50.0
|
||||
|
||||
jobs:
|
||||
linting:
|
||||
name: "Lints, pinned toolchain"
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
- name: Install toolchain
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: ${{ env['ACTIONS_LINTS_TOOLCHAIN'] }}
|
||||
default: true
|
||||
components: rustfmt, clippy
|
||||
- name: cargo fmt (check)
|
||||
run: cd tests/inst && cargo fmt -- --check -l
|
@ -108,21 +108,22 @@ impl RebootMark {
|
||||
strategy: &InterruptStrategy,
|
||||
) -> &mut BTreeMap<UpdateResult, u32> {
|
||||
match strategy {
|
||||
InterruptStrategy::Polite(t) => self
|
||||
.polite
|
||||
.entry(t.clone())
|
||||
.or_insert_with(BTreeMap::new),
|
||||
InterruptStrategy::Force(t) => self
|
||||
.force
|
||||
.entry(t.clone())
|
||||
.or_insert_with(BTreeMap::new),
|
||||
InterruptStrategy::Polite(t) => {
|
||||
self.polite.entry(t.clone()).or_insert_with(BTreeMap::new)
|
||||
}
|
||||
InterruptStrategy::Force(t) => {
|
||||
self.force.entry(t.clone()).or_insert_with(BTreeMap::new)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl InterruptStrategy {
|
||||
pub(crate) fn is_noop(&self) -> bool {
|
||||
matches!(self, InterruptStrategy::Polite(PoliteInterruptStrategy::None))
|
||||
matches!(
|
||||
self,
|
||||
InterruptStrategy::Polite(PoliteInterruptStrategy::None)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@ -598,9 +599,7 @@ fn transactionality() -> Result<()> {
|
||||
upgrade_and_finalize().context("Firstrun upgrade failed")?;
|
||||
let end = time::Instant::now();
|
||||
let cycle_time = end.duration_since(start);
|
||||
let tdata = TransactionalTestInfo {
|
||||
cycle_time,
|
||||
};
|
||||
let tdata = TransactionalTestInfo { cycle_time };
|
||||
let mut f = std::io::BufWriter::new(std::fs::File::create(&TDATAPATH)?);
|
||||
serde_json::to_writer(&mut f, &tdata)?;
|
||||
f.flush()?;
|
||||
|
@ -82,7 +82,7 @@ pub(crate) const TEST_HTTP_BASIC_AUTH: &str = "foouser:barpw";
|
||||
fn validate_authz(value: &[u8]) -> Result<bool> {
|
||||
let buf = std::str::from_utf8(&value)?;
|
||||
if let Some(o) = buf.find("Basic ") {
|
||||
let (_, buf) = buf.split_at(o + "Basic ".len());
|
||||
let (_, buf) = buf.split_at(o + "Basic ".len());
|
||||
let buf = base64::decode(buf).context("decoding")?;
|
||||
let buf = std::str::from_utf8(&buf)?;
|
||||
Ok(buf == TEST_HTTP_BASIC_AUTH)
|
||||
|
Loading…
Reference in New Issue
Block a user