• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

divviup / divviup-api / 16946563839

13 Aug 2025 06:54PM UTC coverage: 55.907% (+0.03%) from 55.879%
16946563839

push

github

web-flow
use correct request path for agg job metrics (#1857)

Now it matches the path served by Janus ([1])

[1]: https://github.com/divviup/janus/blob/1fc4ac830/aggregator_api/src/lib.rs#L103

0 of 1 new or added line in 1 file covered. (0.0%)

1 existing line in 1 file now uncovered.

3885 of 6949 relevant lines covered (55.91%)

60.27 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

72.73
/src/entity/aggregator/role.rs
1
use rand::{distributions::Standard, prelude::Distribution};
2
use sea_orm::{DeriveActiveEnum, EnumIter};
3
use serde::{Deserialize, Serialize};
4
use std::{
5
    error::Error,
6
    fmt::{self, Display, Formatter},
7
    str::FromStr,
8
};
9

10
#[derive(Debug, Clone, Copy, PartialEq, Eq, EnumIter, DeriveActiveEnum, Serialize, Deserialize)]
11
#[sea_orm(rs_type = "i32", db_type = "Integer")]
12
pub enum Role {
13
    #[sea_orm(num_value = 0)]
14
    Leader,
15
    #[sea_orm(num_value = 1)]
16
    Helper,
17
    #[sea_orm(num_value = 2)]
18
    Either,
19
}
20

21
impl Distribution<Role> for Standard {
22
    fn sample<R: rand::Rng + ?Sized>(&self, rng: &mut R) -> Role {
22✔
23
        match rng.gen_range(0..3) {
22✔
24
            0 => Role::Leader,
10✔
25
            1 => Role::Helper,
5✔
26
            _ => Role::Either,
7✔
27
        }
28
    }
22✔
29
}
30
impl AsRef<str> for Role {
31
    fn as_ref(&self) -> &str {
2✔
32
        match self {
2✔
UNCOV
33
            Self::Leader => "leader",
×
34
            Self::Helper => "helper",
×
35
            Self::Either => "either",
2✔
36
        }
37
    }
2✔
38
}
39

40
#[derive(Debug)]
41
pub struct UnrecognizedRole(String);
42
impl Display for UnrecognizedRole {
43
    fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
×
44
        f.write_fmt(format_args!("{} was not a recognized role option", self.0))
×
45
    }
×
46
}
47
impl Error for UnrecognizedRole {}
48
impl FromStr for Role {
49
    type Err = UnrecognizedRole;
50
    fn from_str(s: &str) -> Result<Self, Self::Err> {
2✔
51
        match &*s.to_lowercase() {
2✔
52
            "leader" => Ok(Self::Leader),
2✔
53
            "helper" => Ok(Self::Helper),
2✔
54
            "either" => Ok(Self::Either),
2✔
55
            unrecognized => Err(UnrecognizedRole(unrecognized.to_string())),
×
56
        }
57
    }
2✔
58
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc