From 7612eab743bbe885ce27323dd77f2c98333912fa Mon Sep 17 00:00:00 2001 From: MasterPtato Date: Thu, 4 Jul 2024 00:17:38 +0000 Subject: [PATCH] chore: rename lib/types -> lib/types-proto --- lib/api-helper/build/Cargo.toml | 2 +- lib/api-helper/build/src/ctx.rs | 2 +- lib/cache/build/Cargo.toml | 2 +- lib/chirp/client/Cargo.toml | 2 +- lib/chirp/client/src/client.rs | 2 +- lib/chirp/client/src/lib.rs | 2 +- lib/chirp/client/src/message.rs | 8 ++-- lib/chirp/perf/Cargo.toml | 2 +- lib/chirp/perf/src/ctx.rs | 2 +- lib/chirp/worker/Cargo.toml | 2 +- lib/chirp/worker/src/manager.rs | 2 +- lib/chirp/worker/src/prelude.rs | 2 +- lib/claims/Cargo.toml | 2 +- lib/claims/src/lib.rs | 2 +- lib/convert/Cargo.toml | 2 +- lib/convert/src/convert/game.rs | 2 +- lib/convert/src/convert/group.rs | 2 +- lib/convert/src/convert/identity.rs | 2 +- lib/convert/src/convert/mod.rs | 2 +- lib/convert/src/fetch/game.rs | 2 +- lib/global-error/Cargo.toml | 6 +-- lib/global-error/src/error.rs | 2 +- lib/operation/core/Cargo.toml | 2 +- lib/operation/core/src/prelude.rs | 2 +- lib/{types => types-proto}/Cargo.toml | 0 lib/{types => types-proto}/build/Cargo.toml | 2 +- lib/{types => types-proto}/build/src/lib.rs | 0 .../build/static/uuid_expanded.rs | 0 lib/{types => types-proto}/core/Cargo.toml | 6 +-- lib/{types => types-proto}/core/build.rs | 4 +- lib/{types => types-proto}/core/src/lib.rs | 0 lib/util/core/Cargo.toml | 2 +- lib/util/core/src/glob.rs | 2 +- lib/util/core/src/route.rs | 2 +- lib/util/env/Cargo.toml | 2 +- lib/util/env/src/lib.rs | 4 +- svc/Cargo.lock | 28 ++++++------- .../migrations/20240701225245_add_json.up.sql | 4 +- svc/pkg/cluster/src/lib.rs | 1 + svc/pkg/cluster/tests/get.rs | 39 +++++++++++++++++++ svc/pkg/cluster/testsTMP/get.rs | 24 ------------ svc/pkg/linode/src/lib.rs | 1 + 42 files changed, 98 insertions(+), 81 deletions(-) rename lib/{types => types-proto}/Cargo.toml (100%) rename lib/{types => types-proto}/build/Cargo.toml (93%) rename lib/{types => types-proto}/build/src/lib.rs (100%) rename lib/{types => types-proto}/build/static/uuid_expanded.rs (100%) rename lib/{types => types-proto}/core/Cargo.toml (77%) rename lib/{types => types-proto}/core/build.rs (50%) rename lib/{types => types-proto}/core/src/lib.rs (100%) create mode 100644 svc/pkg/cluster/tests/get.rs delete mode 100644 svc/pkg/cluster/testsTMP/get.rs diff --git a/lib/api-helper/build/Cargo.toml b/lib/api-helper/build/Cargo.toml index 193b1b393..ef08377ac 100644 --- a/lib/api-helper/build/Cargo.toml +++ b/lib/api-helper/build/Cargo.toml @@ -44,7 +44,7 @@ tracing-subscriber = { version = "0.3", default-features = false, features = [ "json", "ansi", ] } -types = { path = "../../types/core" } +types-proto = { path = "../../types-proto/core" } url = "2.2.2" uuid = { version = "1", features = ["v4"] } diff --git a/lib/api-helper/build/src/ctx.rs b/lib/api-helper/build/src/ctx.rs index 629f7b73d..50b3a034b 100644 --- a/lib/api-helper/build/src/ctx.rs +++ b/lib/api-helper/build/src/ctx.rs @@ -2,7 +2,7 @@ use std::net::IpAddr; use chirp_workflow::ctx::ApiCtx; use rivet_operation::OperationContext; -use types::rivet::backend; +use types_proto::rivet::backend; use url::Url; use crate::auth; diff --git a/lib/cache/build/Cargo.toml b/lib/cache/build/Cargo.toml index ae6dc7c3d..a487b2103 100644 --- a/lib/cache/build/Cargo.toml +++ b/lib/cache/build/Cargo.toml @@ -20,7 +20,7 @@ serde_json = "1.0" thiserror = "1.0" tokio = { version = "1.29", features = ["full"] } tracing = "0.1" -types = { path = "../../types/core" } +types-proto = { path = "../../types-proto/core" } uuid = { version = "1", features = ["v4"] } [dependencies.redis] diff --git a/lib/chirp/client/Cargo.toml b/lib/chirp/client/Cargo.toml index d91e8eb78..aca7d110e 100644 --- a/lib/chirp/client/Cargo.toml +++ b/lib/chirp/client/Cargo.toml @@ -22,7 +22,7 @@ thiserror = "1.0" tokio = { version = "1.29", features = ["full"] } tokio-util = "0.7" tracing = "0.1" -types = { path = "../../types/core" } +types-proto = { path = "../../types-proto/core" } urlencoding = "2.1" uuid = { version = "1", features = ["v4"] } diff --git a/lib/chirp/client/src/client.rs b/lib/chirp/client/src/client.rs index 86fc5269c..1a6ef17cf 100644 --- a/lib/chirp/client/src/client.rs +++ b/lib/chirp/client/src/client.rs @@ -16,7 +16,7 @@ use rivet_util::Backoff; use tokio::task::JoinSet; use tokio_util::sync::{CancellationToken, DropGuard}; use tracing::Instrument; -use types::rivet::chirp; +use types_proto::rivet::chirp; use uuid::Uuid; use crate::{ diff --git a/lib/chirp/client/src/lib.rs b/lib/chirp/client/src/lib.rs index 997d81cfe..6d21f95cf 100644 --- a/lib/chirp/client/src/lib.rs +++ b/lib/chirp/client/src/lib.rs @@ -10,4 +10,4 @@ pub mod prelude; pub mod redis_keys; pub use client::*; -pub use types::rivet::chirp::{RequestDebug, RunContext, TraceEntry}; +pub use types_proto::rivet::chirp::{RequestDebug, RunContext, TraceEntry}; diff --git a/lib/chirp/client/src/message.rs b/lib/chirp/client/src/message.rs index 7f76051b2..5d9a24c5b 100644 --- a/lib/chirp/client/src/message.rs +++ b/lib/chirp/client/src/message.rs @@ -97,9 +97,9 @@ where #[tracing::instrument(skip(buf))] pub(crate) fn decode_inner( buf: &[u8], - ) -> Result<(types::rivet::chirp::Message, Vec), ClientError> { + ) -> Result<(types_proto::rivet::chirp::Message, Vec), ClientError> { // Decode the message and trace - let message = ::decode(buf) + let message = ::decode(buf) .map_err(ClientError::DecodeMessage)?; let trace = message @@ -167,10 +167,10 @@ impl TraceEntry { } } -impl TryFrom for TraceEntry { +impl TryFrom for TraceEntry { type Error = ClientError; - fn try_from(value: types::rivet::chirp::TraceEntry) -> Result { + fn try_from(value: types_proto::rivet::chirp::TraceEntry) -> Result { Ok(TraceEntry { context_name: value.context_name.clone(), req_id: value diff --git a/lib/chirp/perf/Cargo.toml b/lib/chirp/perf/Cargo.toml index b1ca60828..2b2b6b01a 100644 --- a/lib/chirp/perf/Cargo.toml +++ b/lib/chirp/perf/Cargo.toml @@ -8,7 +8,7 @@ license = "Apache-2.0" [dependencies] lazy_static = "1.4" prost = "0.10" -types = { path = "../../types/core" } +types-proto = { path = "../../types-proto/core" } rivet-metrics = { path = "../../metrics" } rivet-pools = { path = "../../pools" } thiserror = "1.0" diff --git a/lib/chirp/perf/src/ctx.rs b/lib/chirp/perf/src/ctx.rs index 3e4cf1529..4f472e872 100644 --- a/lib/chirp/perf/src/ctx.rs +++ b/lib/chirp/perf/src/ctx.rs @@ -11,7 +11,7 @@ use std::{ use rivet_pools::prelude::*; use tokio::sync::RwLock; use tracing::Instrument; -use types::rivet::perf; +use types_proto::rivet::perf; use uuid::Uuid; #[derive(thiserror::Error, Debug)] diff --git a/lib/chirp/worker/Cargo.toml b/lib/chirp/worker/Cargo.toml index fa6d57706..fba109fb2 100644 --- a/lib/chirp/worker/Cargo.toml +++ b/lib/chirp/worker/Cargo.toml @@ -34,7 +34,7 @@ serde_json = "1.0" thiserror = "1.0" tokio = { version = "1.29", features = ["full", "tracing"] } tracing = "0.1" -types = { path = "../../types/core" } +types-proto = { path = "../../types-proto/core" } tracing-subscriber = { version = "0.3", optional = true, default-features = false, features = [ "fmt", "json", diff --git a/lib/chirp/worker/src/manager.rs b/lib/chirp/worker/src/manager.rs index 225ad7c59..d7d75c7c3 100644 --- a/lib/chirp/worker/src/manager.rs +++ b/lib/chirp/worker/src/manager.rs @@ -15,7 +15,7 @@ use rivet_pools::prelude::*; use rivet_util::CleanExit; use tokio::time; use tracing::Instrument; -use types::rivet::chirp; +use types_proto::rivet::chirp; use crate::{ config::{Config, WorkerKind}, diff --git a/lib/chirp/worker/src/prelude.rs b/lib/chirp/worker/src/prelude.rs index aa0f3e414..9947c8f3c 100644 --- a/lib/chirp/worker/src/prelude.rs +++ b/lib/chirp/worker/src/prelude.rs @@ -44,4 +44,4 @@ pub use thiserror; pub use tokio; #[doc(hidden)] pub use tracing; -pub use types::{self, rivet as proto, rivet::common}; +pub use types_proto::{self, rivet as proto, rivet::common}; diff --git a/lib/claims/Cargo.toml b/lib/claims/Cargo.toml index 7074cfde0..2031a871d 100644 --- a/lib/claims/Cargo.toml +++ b/lib/claims/Cargo.toml @@ -9,7 +9,7 @@ license = "Apache-2.0" base64 = "0.13" jsonwebtoken = "8.2.0" global-error = { path = "../global-error" } -types = { path = "../types/core" } +types-proto = { path = "../types-proto/core" } lazy_static = "1.4" prost = "0.10" rivet-util = { path = "../util/core" } diff --git a/lib/claims/src/lib.rs b/lib/claims/src/lib.rs index b8885ab31..8076332e3 100644 --- a/lib/claims/src/lib.rs +++ b/lib/claims/src/lib.rs @@ -5,7 +5,7 @@ use jsonwebtoken::{Algorithm, DecodingKey}; use prost::Message; mod schema { - pub use types::rivet::{backend, claims::*}; + pub use types_proto::rivet::{backend, claims::*}; } pub const ALGORITHM: Algorithm = Algorithm::EdDSA; diff --git a/lib/convert/Cargo.toml b/lib/convert/Cargo.toml index b0746b42a..f4661f8a9 100644 --- a/lib/convert/Cargo.toml +++ b/lib/convert/Cargo.toml @@ -11,7 +11,7 @@ rivet-operation = { path = "../operation/core" } serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" chrono = "0.4" -types = { path = "../types/core" } +types-proto = { path = "../types-proto/core" } util-mm = { package = "rivet-util-mm", path = "../../svc/pkg/mm/util" } cdn-namespace-get = { path = "../../svc/pkg/cdn/ops/namespace-get" } diff --git a/lib/convert/src/convert/game.rs b/lib/convert/src/convert/game.rs index 489a83cbe..26945bb6d 100644 --- a/lib/convert/src/convert/game.rs +++ b/lib/convert/src/convert/game.rs @@ -1,6 +1,6 @@ use rivet_api::models; use rivet_operation::prelude::*; -use types::rivet::backend; +use types_proto::rivet::backend; use crate::{convert, fetch, ApiTryInto}; diff --git a/lib/convert/src/convert/group.rs b/lib/convert/src/convert/group.rs index 6bd44e42b..37db329f4 100644 --- a/lib/convert/src/convert/group.rs +++ b/lib/convert/src/convert/group.rs @@ -2,7 +2,7 @@ use std::convert::TryInto; use rivet_api::models; use rivet_operation::prelude::*; -use types::rivet::backend::{self, pkg::*}; +use types_proto::rivet::backend::{self, pkg::*}; use crate::ApiInto; diff --git a/lib/convert/src/convert/identity.rs b/lib/convert/src/convert/identity.rs index ae9edc0b5..586ceab42 100644 --- a/lib/convert/src/convert/identity.rs +++ b/lib/convert/src/convert/identity.rs @@ -1,6 +1,6 @@ use rivet_api::models; use rivet_operation::prelude::*; -use types::rivet::{ +use types_proto::rivet::{ backend::{self, pkg::*}, common, }; diff --git a/lib/convert/src/convert/mod.rs b/lib/convert/src/convert/mod.rs index 4f91ec26d..c891fec52 100644 --- a/lib/convert/src/convert/mod.rs +++ b/lib/convert/src/convert/mod.rs @@ -1,7 +1,7 @@ // This module converts proto data information into smithy models. It's important to separate fetching // from building models so that we can convert already existing data without having to re-fetch it. use rivet_operation::prelude::*; -use types::rivet::backend; +use types_proto::rivet::backend; pub mod game; pub mod group; diff --git a/lib/convert/src/fetch/game.rs b/lib/convert/src/fetch/game.rs index 631cf75f8..446c916a8 100644 --- a/lib/convert/src/fetch/game.rs +++ b/lib/convert/src/fetch/game.rs @@ -2,7 +2,7 @@ use std::collections::HashMap; use rivet_api::models; use rivet_operation::prelude::*; -use types::rivet::{ +use types_proto::rivet::{ backend::{self, pkg::*}, common, }; diff --git a/lib/global-error/Cargo.toml b/lib/global-error/Cargo.toml index e11f2ef4f..13a8529d7 100644 --- a/lib/global-error/Cargo.toml +++ b/lib/global-error/Cargo.toml @@ -6,13 +6,13 @@ edition = "2021" license = "Apache-2.0" [features] -protobuf-src = ["types/protobuf-src"] -chirp = ["types"] +protobuf-src = ["types-proto/protobuf-src"] +chirp = ["types-proto"] [dependencies] async-trait = "0.1" formatted-error = { path = "../formatted-error" } -types = { path = "../types/core", optional = true } +types-proto = { path = "../types-proto/core", optional = true } http = "0.2" reqwest = "0.11" serde = { version = "1.0", features = ["derive"] } diff --git a/lib/global-error/src/error.rs b/lib/global-error/src/error.rs index 124cfeaa9..ba3d04c6b 100644 --- a/lib/global-error/src/error.rs +++ b/lib/global-error/src/error.rs @@ -3,7 +3,7 @@ use std::{collections::HashMap, fmt::Display}; use http::StatusCode; use serde::Serialize; #[cfg(feature = "chirp")] -use types::rivet::chirp; +use types_proto::rivet::chirp; pub type GlobalResult = Result; diff --git a/lib/operation/core/Cargo.toml b/lib/operation/core/Cargo.toml index 8af04240d..8ba0c91bb 100644 --- a/lib/operation/core/Cargo.toml +++ b/lib/operation/core/Cargo.toml @@ -25,4 +25,4 @@ serde_json = "1.0" thiserror = "1.0" tokio = { version = "1.29", features = ["full", "tracing"] } tracing = "0.1" -types = { path = "../../types/core" } +types-proto = { path = "../../types-proto/core" } diff --git a/lib/operation/core/src/prelude.rs b/lib/operation/core/src/prelude.rs index b008f0f78..e0bad50d1 100644 --- a/lib/operation/core/src/prelude.rs +++ b/lib/operation/core/src/prelude.rs @@ -38,6 +38,6 @@ pub use thiserror; pub use tokio; #[doc(hidden)] pub use tracing; -pub use types::{self, rivet as proto, rivet::common}; +pub use types_proto::{self, rivet as proto, rivet::common}; pub use crate::OperationContext; diff --git a/lib/types/Cargo.toml b/lib/types-proto/Cargo.toml similarity index 100% rename from lib/types/Cargo.toml rename to lib/types-proto/Cargo.toml diff --git a/lib/types/build/Cargo.toml b/lib/types-proto/build/Cargo.toml similarity index 93% rename from lib/types/build/Cargo.toml rename to lib/types-proto/build/Cargo.toml index 48454769f..ee88e15b0 100644 --- a/lib/types/build/Cargo.toml +++ b/lib/types-proto/build/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "types-build" +name = "types-proto-build" version = "0.1.0" edition = "2021" authors = ["Rivet Gaming, LLC "] diff --git a/lib/types/build/src/lib.rs b/lib/types-proto/build/src/lib.rs similarity index 100% rename from lib/types/build/src/lib.rs rename to lib/types-proto/build/src/lib.rs diff --git a/lib/types/build/static/uuid_expanded.rs b/lib/types-proto/build/static/uuid_expanded.rs similarity index 100% rename from lib/types/build/static/uuid_expanded.rs rename to lib/types-proto/build/static/uuid_expanded.rs diff --git a/lib/types/core/Cargo.toml b/lib/types-proto/core/Cargo.toml similarity index 77% rename from lib/types/core/Cargo.toml rename to lib/types-proto/core/Cargo.toml index f7a78c571..653082416 100644 --- a/lib/types/core/Cargo.toml +++ b/lib/types-proto/core/Cargo.toml @@ -1,12 +1,12 @@ [package] -name = "types" +name = "types-proto" version = "0.1.0" edition = "2021" authors = ["Rivet Gaming, LLC "] license = "Apache-2.0" [features] -protobuf-src = ["types-build/protobuf-src"] +protobuf-src = ["types-proto-build/protobuf-src"] [dependencies] chirp-types = { path = "../../chirp/types" } @@ -19,4 +19,4 @@ thiserror = "1.0" http = "0.2" [build-dependencies] -types-build = { path = "../build" } +types-proto-build = { path = "../build" } diff --git a/lib/types/core/build.rs b/lib/types-proto/core/build.rs similarity index 50% rename from lib/types/core/build.rs rename to lib/types-proto/core/build.rs index 8c6b1bbca..115078535 100644 --- a/lib/types/core/build.rs +++ b/lib/types-proto/core/build.rs @@ -1,6 +1,6 @@ -use types_build; +use types_proto_build; fn main() -> std::io::Result<()> { // Build schema - types_build::compile() + types_proto_build::compile() } diff --git a/lib/types/core/src/lib.rs b/lib/types-proto/core/src/lib.rs similarity index 100% rename from lib/types/core/src/lib.rs rename to lib/types-proto/core/src/lib.rs diff --git a/lib/util/core/Cargo.toml b/lib/util/core/Cargo.toml index fe3948ada..a2a089a50 100644 --- a/lib/util/core/Cargo.toml +++ b/lib/util/core/Cargo.toml @@ -35,7 +35,7 @@ tokio = { version = "1.29", default-features = false, features = [ "test-util", "macros", ] } -types = { path = "../../types/core" } +types-proto = { path = "../../types-proto/core" } uuid = { version = "1", features = ["v4", "serde"] } aws-smithy-client = "^0.41.0" diff --git a/lib/util/core/src/glob.rs b/lib/util/core/src/glob.rs index fc7f68fb5..8ebafadab 100644 --- a/lib/util/core/src/glob.rs +++ b/lib/util/core/src/glob.rs @@ -6,7 +6,7 @@ use std::{ use global_error::prelude::*; use regex; -use types::rivet::common; +use types_proto::rivet::common; #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub enum GlobToken { diff --git a/lib/util/core/src/route.rs b/lib/util/core/src/route.rs index bcb6ad38f..640e393ca 100644 --- a/lib/util/core/src/route.rs +++ b/lib/util/core/src/route.rs @@ -1,4 +1,4 @@ -use types::rivet::backend; +use types_proto::rivet::backend; use uuid::Uuid; use global_error::prelude::*; diff --git a/lib/util/env/Cargo.toml b/lib/util/env/Cargo.toml index 7306f767b..f2b4c49e1 100644 --- a/lib/util/env/Cargo.toml +++ b/lib/util/env/Cargo.toml @@ -11,4 +11,4 @@ serde = { version = "1.0.193", features = ["derive"] } serde_json = "1.0.109" thiserror = "1.0" uuid = { version = "1", features = ["v4"] } -types = { path = "../../types/core" } +types-proto = { path = "../../types-proto/core" } diff --git a/lib/util/env/src/lib.rs b/lib/util/env/src/lib.rs index 35b9808cd..b8939256e 100644 --- a/lib/util/env/src/lib.rs +++ b/lib/util/env/src/lib.rs @@ -108,11 +108,11 @@ pub fn support_deprecated_subdomains() -> bool { *SUPPORT_DEPRECATED_SUBDOMAINS } -pub fn test_id_param() -> Vec { +pub fn test_id_param() -> Vec { TEST_ID .as_ref() .iter() - .map(|x| types::rivet::backend::job::Parameter { + .map(|x| types_proto::rivet::backend::job::Parameter { key: "rivet_test_id".to_string(), value: x.to_string(), }) diff --git a/svc/Cargo.lock b/svc/Cargo.lock index 94b712f20..83c35c179 100644 --- a/svc/Cargo.lock +++ b/svc/Cargo.lock @@ -420,7 +420,7 @@ dependencies = [ "tokio", "tracing", "tracing-subscriber", - "types", + "types-proto", "url", "uuid", ] @@ -1987,7 +1987,7 @@ dependencies = [ "tokio", "tokio-util 0.7.10", "tracing", - "types", + "types-proto", "urlencoding", "uuid", ] @@ -2012,7 +2012,7 @@ dependencies = [ "thiserror", "tokio", "tracing", - "types", + "types-proto", "uuid", ] @@ -2052,7 +2052,7 @@ dependencies = [ "tokio", "tracing", "tracing-subscriber", - "types", + "types-proto", "uuid", ] @@ -3967,7 +3967,7 @@ dependencies = [ "serde", "serde_json", "thiserror", - "types", + "types-proto", ] [[package]] @@ -6903,7 +6903,7 @@ dependencies = [ "thiserror", "tokio", "tracing", - "types", + "types-proto", "uuid", ] @@ -6949,7 +6949,7 @@ dependencies = [ "serde", "serde_json", "thiserror", - "types", + "types-proto", "uuid", ] @@ -7002,7 +7002,7 @@ dependencies = [ "team-member-count", "team-profile-validate", "team-validate", - "types", + "types-proto", "user-follow-count", "user-follow-get", "user-get", @@ -7151,7 +7151,7 @@ dependencies = [ "thiserror", "tokio", "tracing", - "types", + "types-proto", ] [[package]] @@ -7278,7 +7278,7 @@ dependencies = [ "serde_json", "thiserror", "tokio", - "types", + "types-proto", "uuid", ] @@ -7309,7 +7309,7 @@ dependencies = [ "serde", "serde_json", "thiserror", - "types", + "types-proto", "uuid", ] @@ -9164,7 +9164,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" [[package]] -name = "types" +name = "types-proto" version = "0.1.0" dependencies = [ "chirp-types", @@ -9174,12 +9174,12 @@ dependencies = [ "serde", "serde_json", "thiserror", - "types-build", + "types-proto-build", "uuid", ] [[package]] -name = "types-build" +name = "types-proto-build" version = "0.1.0" dependencies = [ "bolt-config", diff --git a/svc/pkg/cluster/db/cluster/migrations/20240701225245_add_json.up.sql b/svc/pkg/cluster/db/cluster/migrations/20240701225245_add_json.up.sql index 8995966b8..558d80d80 100644 --- a/svc/pkg/cluster/db/cluster/migrations/20240701225245_add_json.up.sql +++ b/svc/pkg/cluster/db/cluster/migrations/20240701225245_add_json.up.sql @@ -13,10 +13,10 @@ ALTER TABLE datacenter_tls ADD COLUMN state2 JSONB; -- cluster::types::TlsState CREATE TABLE server_images2 ( - provider JSONB, + provider TEXT, -- cluster::types::Provider install_hash TEXT, datacenter_id UUID, - pool_type JSONB, + pool_type TEXT, -- cluster::types::PoolType create_ts INT NOT NULL, -- After the image expires and is destroyed diff --git a/svc/pkg/cluster/src/lib.rs b/svc/pkg/cluster/src/lib.rs index b2ed2a6e7..5a3fbb5a6 100644 --- a/svc/pkg/cluster/src/lib.rs +++ b/svc/pkg/cluster/src/lib.rs @@ -19,6 +19,7 @@ pub fn registry() -> Registry { registry.register_workflow::(); registry.register_workflow::(); registry.register_workflow::(); + registry.register_workflow::(); registry } diff --git a/svc/pkg/cluster/tests/get.rs b/svc/pkg/cluster/tests/get.rs new file mode 100644 index 000000000..03859d7c0 --- /dev/null +++ b/svc/pkg/cluster/tests/get.rs @@ -0,0 +1,39 @@ +use chirp_workflow::prelude::*; +use serde_json::json; + +#[workflow_test] +async fn cluster_get(ctx: TestCtx) { + let cluster_id = Uuid::new_v4(); + + let mut sub = ctx + .subscribe::(&json!({ + "cluster_id": cluster_id, + })) + .await + .unwrap(); + + ctx.dispatch_tagged_workflow( + &json!({ + "cluster_id": cluster_id, + }), + cluster::workflows::cluster::Input { + cluster_id, + name_id: util::faker::ident(), + owner_team_id: None, + }, + ) + .await + .unwrap(); + + sub.next().await.unwrap(); + + let res = ctx + .op(cluster::ops::get::Input { + cluster_ids: vec![cluster_id], + }) + .await + .unwrap(); + let cluster = res.clusters.first().expect("cluster not found"); + + assert_eq!(cluster_id, cluster.cluster_id); +} diff --git a/svc/pkg/cluster/testsTMP/get.rs b/svc/pkg/cluster/testsTMP/get.rs deleted file mode 100644 index c273681e3..000000000 --- a/svc/pkg/cluster/testsTMP/get.rs +++ /dev/null @@ -1,24 +0,0 @@ -use chirp_worker::prelude::*; -use proto::backend::pkg::*; - -#[worker_test] -async fn empty(ctx: TestCtx) { - let cluster_id = Uuid::new_v4(); - - msg!([ctx] cluster::msg::create(cluster_id) -> cluster::msg::create_complete { - cluster_id: Some(cluster_id.into()), - name_id: util::faker::ident(), - owner_team_id: None, - }) - .await - .unwrap(); - - let res = op!([ctx] cluster_get { - cluster_ids: vec![cluster_id.into()], - }) - .await - .unwrap(); - let cluster = res.clusters.first().expect("cluster not found"); - - assert_eq!(cluster_id, cluster.cluster_id.unwrap().as_uuid()); -} diff --git a/svc/pkg/linode/src/lib.rs b/svc/pkg/linode/src/lib.rs index 1ebf758e3..f09fb574a 100644 --- a/svc/pkg/linode/src/lib.rs +++ b/svc/pkg/linode/src/lib.rs @@ -10,6 +10,7 @@ pub fn registry() -> Registry { let mut registry = Registry::new(); registry.register_workflow::(); + registry.register_workflow::(); registry }