mirror of
https://github.com/kjuulh/dagger-rs.git
synced 2025-08-17 20:53:29 +02:00
Compare commits
12 Commits
Author | SHA1 | Date | |
---|---|---|---|
37b8b1212b
|
|||
2c04387c3d
|
|||
1b31331765
|
|||
a8e6dde615
|
|||
1bfd084cd2 | |||
5593fce2e1 | |||
2cc0231c5f | |||
9ba01396cb | |||
c025d17424 | |||
e9e35edb1c | |||
d7317e5cf3 | |||
f67928155f |
2
Cargo.lock
generated
2
Cargo.lock
generated
@@ -309,7 +309,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "dagger-sdk"
|
||||
version = "0.2.16"
|
||||
version = "0.2.18"
|
||||
dependencies = [
|
||||
"base64",
|
||||
"dagger-core",
|
||||
|
55
README.md
Normal file
55
README.md
Normal file
@@ -0,0 +1,55 @@
|
||||
# dagger-sdk
|
||||
|
||||
A dagger sdk written in rust for rust.
|
||||
|
||||
## Examples
|
||||
|
||||
See [examples](./crates/dagger-sdk/examples/)
|
||||
|
||||
Run them like so
|
||||
|
||||
```bash
|
||||
cargo run --example first-pipeline
|
||||
```
|
||||
|
||||
The examples match the folder name in each directory in examples
|
||||
|
||||
## Install
|
||||
|
||||
Simply install like:
|
||||
|
||||
```bash
|
||||
cargo add dagger-sdk
|
||||
```
|
||||
|
||||
### Usage
|
||||
|
||||
```rust
|
||||
#[tokio::main]
|
||||
async fn main() -> eyre::Result<()> {
|
||||
let client = dagger_sdk::connect().await?;
|
||||
|
||||
let version = client
|
||||
.container()
|
||||
.from("golang:1.19")
|
||||
.with_exec(vec!["go", "version"])
|
||||
.stdout()
|
||||
.await?;
|
||||
|
||||
println!("Hello from Dagger and {}", version.trim());
|
||||
|
||||
Ok(())
|
||||
}
|
||||
```
|
||||
|
||||
And run it like a normal application:
|
||||
|
||||
```bash
|
||||
cargo run
|
||||
```
|
||||
|
||||
### Contributing
|
||||
|
||||
See [CONTRIBUTING](./CONTRIBUTING.md)
|
||||
|
||||
or just cargo make codegen
|
@@ -8,6 +8,6 @@ edition = "2021"
|
||||
[dependencies]
|
||||
clap = "4.1.6"
|
||||
color-eyre = "0.6.2"
|
||||
dagger-sdk = { path = "../crates/dagger-sdk/", version = "^0.2.16" }
|
||||
dagger-sdk = { path = "../crates/dagger-sdk/", version = "^0.2.18" }
|
||||
eyre = "0.6.8"
|
||||
tokio = { version = "1.25.0", features = ["full"] }
|
||||
|
@@ -196,6 +196,22 @@ pub fn type_ref_is_scalar(type_ref: &TypeRef) -> bool {
|
||||
.unwrap_or(false)
|
||||
}
|
||||
|
||||
pub fn type_ref_is_enum(type_ref: &TypeRef) -> bool {
|
||||
let mut type_ref = type_ref.clone();
|
||||
if type_ref
|
||||
.kind
|
||||
.pipe(|k| *k == __TypeKind::NON_NULL)
|
||||
.unwrap_or(false)
|
||||
{
|
||||
type_ref = *type_ref.of_type.unwrap().clone();
|
||||
}
|
||||
|
||||
type_ref
|
||||
.kind
|
||||
.pipe(|k| *k == __TypeKind::ENUM)
|
||||
.unwrap_or(false)
|
||||
}
|
||||
|
||||
pub fn type_ref_is_object(type_ref: &TypeRef) -> bool {
|
||||
let mut type_ref = type_ref.clone();
|
||||
if type_ref
|
||||
|
@@ -5,8 +5,8 @@ use genco::quote;
|
||||
use genco::tokens::quoted;
|
||||
|
||||
use crate::functions::{
|
||||
type_field_has_optional, type_ref_is_list, type_ref_is_list_of_objects, type_ref_is_object,
|
||||
type_ref_is_optional, type_ref_is_scalar, CommonFunctions, Scalar,
|
||||
type_field_has_optional, type_ref_is_enum, type_ref_is_list, type_ref_is_list_of_objects,
|
||||
type_ref_is_object, type_ref_is_optional, type_ref_is_scalar, CommonFunctions, Scalar,
|
||||
};
|
||||
use crate::utility::OptionExt;
|
||||
|
||||
@@ -133,6 +133,12 @@ fn render_required_args(_funcs: &CommonFunctions, field: &FullTypeFields) -> Opt
|
||||
}
|
||||
}
|
||||
|
||||
if type_ref_is_enum(&s.input_value.type_) {
|
||||
return Some(quote! {
|
||||
query = query.arg_enum($(quoted(name)), $(n));
|
||||
})
|
||||
}
|
||||
|
||||
if type_ref_is_list(&s.input_value.type_) {
|
||||
let inner = *s
|
||||
.input_value
|
||||
@@ -187,6 +193,14 @@ fn render_optional_args(_funcs: &CommonFunctions, field: &FullTypeFields) -> Opt
|
||||
let n = format_struct_name(&s.input_value.name);
|
||||
let name = &s.input_value.name;
|
||||
|
||||
if type_ref_is_enum(&s.input_value.type_) {
|
||||
return Some(quote! {
|
||||
if let Some($(&n)) = opts.$(&n) {
|
||||
query = query.arg_enum($(quoted(name)), $(n));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Some(quote! {
|
||||
if let Some($(&n)) = opts.$(&n) {
|
||||
query = query.arg($(quoted(name)), $(&n));
|
||||
|
@@ -11,6 +11,18 @@ pub fn render_scalar(t: &FullType) -> eyre::Result<rust::Tokens> {
|
||||
|
||||
Ok(quote! {
|
||||
#[derive($serialize, $deserialize, PartialEq, Debug, Clone)]
|
||||
pub struct $(t.name.pipe(|n|format_name(n)))(String);
|
||||
pub struct $(t.name.pipe(|n|format_name(n)))(pub String);
|
||||
|
||||
impl Into<$(t.name.pipe(|n| format_name(n)))> for &str {
|
||||
fn into(self) -> $(t.name.pipe(|n| format_name(n))) {
|
||||
$(t.name.pipe(|n| format_name(n)))(self.to_string())
|
||||
}
|
||||
}
|
||||
|
||||
impl Into<$(t.name.pipe(|n| format_name(n)))> for String {
|
||||
fn into(self) -> $(t.name.pipe(|n| format_name(n))) {
|
||||
$(t.name.pipe(|n| format_name(n)))(self.clone())
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@@ -6,8 +6,87 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to
|
||||
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## v0.2.18 (2023-03-14)
|
||||
|
||||
### New Features
|
||||
|
||||
- <csr-id-2c04387c3dd4cfd097a8f142570c58bc756c8ab7/> fix serialization of enum args for graphql
|
||||
|
||||
### Commit Statistics
|
||||
|
||||
<csr-read-only-do-not-edit/>
|
||||
|
||||
- 1 commit contributed to the release.
|
||||
- 1 commit was understood as [conventional](https://www.conventionalcommits.org).
|
||||
- 0 issues like '(#ID)' were seen in commit messages
|
||||
|
||||
### Commit Details
|
||||
|
||||
<csr-read-only-do-not-edit/>
|
||||
|
||||
<details><summary>view details</summary>
|
||||
|
||||
* **Uncategorized**
|
||||
- fix serialization of enum args for graphql ([`2c04387`](https://github.com/kjuulh/dagger-rs/commit/2c04387c3dd4cfd097a8f142570c58bc756c8ab7))
|
||||
</details>
|
||||
|
||||
## v0.2.17 (2023-03-13)
|
||||
|
||||
<csr-id-f67928155f02076cbb41abd4010523879ff3caf1/>
|
||||
<csr-id-2cc0231c5f29993081f0f7e15e44cac95a7d6086/>
|
||||
<csr-id-9ba01396cb44ee02cf7a16008e3f0bdae9f78754/>
|
||||
<csr-id-e9e35edb1cb67eee8cc033212aba3b1888def78f/>
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- <csr-id-1bfd084cd28e2b984c61de7f3f9a065cc41be007/> make sure tests have a command to execute
|
||||
- <csr-id-5593fce2e16e0aa97a2e6843f15d3bb1121048f5/> remove unused imports
|
||||
- <csr-id-c025d1742482d701946c292dcf104421d3cade8e/> add support for String as well
|
||||
- <csr-id-d7317e5cf34ee84a7b092357f5fbb15cd2bae2e3/> add public tuple field and into func
|
||||
- <csr-id-44fa0240f8197f49fdf942b5c3d89079b59195d1/> update rust crate futures to 0.3.27
|
||||
|
||||
### Other
|
||||
|
||||
- <csr-id-f67928155f02076cbb41abd4010523879ff3caf1/> initial issue
|
||||
|
||||
### Refactor
|
||||
|
||||
- <csr-id-2cc0231c5f29993081f0f7e15e44cac95a7d6086/> remove export and instead use exitcode
|
||||
- <csr-id-9ba01396cb44ee02cf7a16008e3f0bdae9f78754/> move issues to actual tests and refactor
|
||||
- <csr-id-e9e35edb1cb67eee8cc033212aba3b1888def78f/> move issues to another folder
|
||||
|
||||
### Commit Statistics
|
||||
|
||||
<csr-read-only-do-not-edit/>
|
||||
|
||||
- 10 commits contributed to the release over the course of 2 calendar days.
|
||||
- 2 days passed between releases.
|
||||
- 9 commits were understood as [conventional](https://www.conventionalcommits.org).
|
||||
- 0 issues like '(#ID)' were seen in commit messages
|
||||
|
||||
### Commit Details
|
||||
|
||||
<csr-read-only-do-not-edit/>
|
||||
|
||||
<details><summary>view details</summary>
|
||||
|
||||
* **Uncategorized**
|
||||
- Release dagger-sdk v0.2.17 ([`a8e6dde`](https://github.com/kjuulh/dagger-rs/commit/a8e6dde615029d9a94d159ed84b5373121cd201f))
|
||||
- make sure tests have a command to execute ([`1bfd084`](https://github.com/kjuulh/dagger-rs/commit/1bfd084cd28e2b984c61de7f3f9a065cc41be007))
|
||||
- remove unused imports ([`5593fce`](https://github.com/kjuulh/dagger-rs/commit/5593fce2e16e0aa97a2e6843f15d3bb1121048f5))
|
||||
- remove export and instead use exitcode ([`2cc0231`](https://github.com/kjuulh/dagger-rs/commit/2cc0231c5f29993081f0f7e15e44cac95a7d6086))
|
||||
- move issues to actual tests and refactor ([`9ba0139`](https://github.com/kjuulh/dagger-rs/commit/9ba01396cb44ee02cf7a16008e3f0bdae9f78754))
|
||||
- add support for String as well ([`c025d17`](https://github.com/kjuulh/dagger-rs/commit/c025d1742482d701946c292dcf104421d3cade8e))
|
||||
- move issues to another folder ([`e9e35ed`](https://github.com/kjuulh/dagger-rs/commit/e9e35edb1cb67eee8cc033212aba3b1888def78f))
|
||||
- add public tuple field and into func ([`d7317e5`](https://github.com/kjuulh/dagger-rs/commit/d7317e5cf34ee84a7b092357f5fbb15cd2bae2e3))
|
||||
- initial issue ([`f679281`](https://github.com/kjuulh/dagger-rs/commit/f67928155f02076cbb41abd4010523879ff3caf1))
|
||||
- update rust crate futures to 0.3.27 ([`44fa024`](https://github.com/kjuulh/dagger-rs/commit/44fa0240f8197f49fdf942b5c3d89079b59195d1))
|
||||
</details>
|
||||
|
||||
## v0.2.16 (2023-03-10)
|
||||
|
||||
<csr-id-e642778d9028726dfb07217814e15ad1dd3b83f2/>
|
||||
|
||||
### Chore
|
||||
|
||||
- <csr-id-e642778d9028726dfb07217814e15ad1dd3b83f2/> fix tasks
|
||||
@@ -32,7 +111,7 @@ and this project adheres to
|
||||
|
||||
<csr-read-only-do-not-edit/>
|
||||
|
||||
- 6 commits contributed to the release over the course of 13 calendar days.
|
||||
- 7 commits contributed to the release over the course of 13 calendar days.
|
||||
- 13 days passed between releases.
|
||||
- 6 commits were understood as [conventional](https://www.conventionalcommits.org).
|
||||
- 0 issues like '(#ID)' were seen in commit messages
|
||||
@@ -44,6 +123,7 @@ and this project adheres to
|
||||
<details><summary>view details</summary>
|
||||
|
||||
* **Uncategorized**
|
||||
- Release dagger-core v0.2.8, dagger-sdk v0.2.16 ([`f390eac`](https://github.com/kjuulh/dagger-rs/commit/f390eac29f1d041d18d2207a5aa0a8d993aab68c))
|
||||
- fix tasks ([`e642778`](https://github.com/kjuulh/dagger-rs/commit/e642778d9028726dfb07217814e15ad1dd3b83f2))
|
||||
- with dagger-engine v.0.4.0 ([`7133bfa`](https://github.com/kjuulh/dagger-rs/commit/7133bfae9508bc5977548e373c49342a1248d6e4))
|
||||
- fix missing await in connect ([`13b7805`](https://github.com/kjuulh/dagger-rs/commit/13b7805e7e6fcf47e0a1318adcc25b4ab773a3c9))
|
||||
|
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "dagger-sdk"
|
||||
version = "0.2.16"
|
||||
version = "0.2.18"
|
||||
edition = "2021"
|
||||
readme = "README.md"
|
||||
license-file = "LICENSE.MIT"
|
||||
@@ -18,7 +18,7 @@ eyre = "0.6.8"
|
||||
futures = "0.3.27"
|
||||
gql_client = "1.0.7"
|
||||
serde = { version = "1.0.152", features = ["derive"] }
|
||||
serde_json = "1.0.93"
|
||||
serde_json = { version = "1.0.93", features = ["raw_value"] }
|
||||
tokio = { version = "1.25.0", features = ["full"] }
|
||||
derive_builder = "0.12.0"
|
||||
|
||||
|
@@ -7,28 +7,112 @@ use std::sync::Arc;
|
||||
use tokio::process::Child;
|
||||
|
||||
#[derive(Serialize, Deserialize, PartialEq, Debug, Clone)]
|
||||
pub struct CacheId(String);
|
||||
pub struct CacheId(pub String);
|
||||
|
||||
impl Into<CacheId> for &str {
|
||||
fn into(self) -> CacheId {
|
||||
CacheId(self.to_string())
|
||||
}
|
||||
}
|
||||
|
||||
impl Into<CacheId> for String {
|
||||
fn into(self) -> CacheId {
|
||||
CacheId(self.clone())
|
||||
}
|
||||
}
|
||||
#[derive(Serialize, Deserialize, PartialEq, Debug, Clone)]
|
||||
pub struct ContainerId(String);
|
||||
pub struct ContainerId(pub String);
|
||||
|
||||
impl Into<ContainerId> for &str {
|
||||
fn into(self) -> ContainerId {
|
||||
ContainerId(self.to_string())
|
||||
}
|
||||
}
|
||||
|
||||
impl Into<ContainerId> for String {
|
||||
fn into(self) -> ContainerId {
|
||||
ContainerId(self.clone())
|
||||
}
|
||||
}
|
||||
#[derive(Serialize, Deserialize, PartialEq, Debug, Clone)]
|
||||
pub struct DirectoryId(String);
|
||||
pub struct DirectoryId(pub String);
|
||||
|
||||
impl Into<DirectoryId> for &str {
|
||||
fn into(self) -> DirectoryId {
|
||||
DirectoryId(self.to_string())
|
||||
}
|
||||
}
|
||||
|
||||
impl Into<DirectoryId> for String {
|
||||
fn into(self) -> DirectoryId {
|
||||
DirectoryId(self.clone())
|
||||
}
|
||||
}
|
||||
#[derive(Serialize, Deserialize, PartialEq, Debug, Clone)]
|
||||
pub struct FileId(String);
|
||||
pub struct FileId(pub String);
|
||||
|
||||
impl Into<FileId> for &str {
|
||||
fn into(self) -> FileId {
|
||||
FileId(self.to_string())
|
||||
}
|
||||
}
|
||||
|
||||
impl Into<FileId> for String {
|
||||
fn into(self) -> FileId {
|
||||
FileId(self.clone())
|
||||
}
|
||||
}
|
||||
#[derive(Serialize, Deserialize, PartialEq, Debug, Clone)]
|
||||
pub struct Platform(String);
|
||||
pub struct Platform(pub String);
|
||||
|
||||
impl Into<Platform> for &str {
|
||||
fn into(self) -> Platform {
|
||||
Platform(self.to_string())
|
||||
}
|
||||
}
|
||||
|
||||
impl Into<Platform> for String {
|
||||
fn into(self) -> Platform {
|
||||
Platform(self.clone())
|
||||
}
|
||||
}
|
||||
#[derive(Serialize, Deserialize, PartialEq, Debug, Clone)]
|
||||
pub struct SecretId(String);
|
||||
pub struct SecretId(pub String);
|
||||
|
||||
impl Into<SecretId> for &str {
|
||||
fn into(self) -> SecretId {
|
||||
SecretId(self.to_string())
|
||||
}
|
||||
}
|
||||
|
||||
impl Into<SecretId> for String {
|
||||
fn into(self) -> SecretId {
|
||||
SecretId(self.clone())
|
||||
}
|
||||
}
|
||||
#[derive(Serialize, Deserialize, PartialEq, Debug, Clone)]
|
||||
pub struct SocketId(String);
|
||||
pub struct SocketId(pub String);
|
||||
|
||||
impl Into<SocketId> for &str {
|
||||
fn into(self) -> SocketId {
|
||||
SocketId(self.to_string())
|
||||
}
|
||||
}
|
||||
|
||||
impl Into<SocketId> for String {
|
||||
fn into(self) -> SocketId {
|
||||
SocketId(self.clone())
|
||||
}
|
||||
}
|
||||
#[derive(Serialize, Deserialize, Debug, PartialEq, Clone)]
|
||||
pub struct BuildArg {
|
||||
pub value: String,
|
||||
pub name: String,
|
||||
pub value: String,
|
||||
}
|
||||
#[derive(Serialize, Deserialize, Debug, PartialEq, Clone)]
|
||||
pub struct PipelineLabel {
|
||||
pub name: String,
|
||||
pub value: String,
|
||||
pub name: String,
|
||||
}
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct CacheVolume {
|
||||
@@ -871,7 +955,7 @@ impl Container {
|
||||
|
||||
query = query.arg("port", port);
|
||||
if let Some(protocol) = opts.protocol {
|
||||
query = query.arg("protocol", protocol);
|
||||
query = query.arg_enum("protocol", protocol);
|
||||
}
|
||||
if let Some(description) = opts.description {
|
||||
query = query.arg("description", description);
|
||||
@@ -1001,7 +1085,7 @@ impl Container {
|
||||
query = query.arg("source", source);
|
||||
}
|
||||
if let Some(sharing) = opts.sharing {
|
||||
query = query.arg("sharing", sharing);
|
||||
query = query.arg_enum("sharing", sharing);
|
||||
}
|
||||
|
||||
return Container {
|
||||
@@ -1311,7 +1395,7 @@ impl Container {
|
||||
|
||||
query = query.arg("port", port);
|
||||
if let Some(protocol) = opts.protocol {
|
||||
query = query.arg("protocol", protocol);
|
||||
query = query.arg_enum("protocol", protocol);
|
||||
}
|
||||
|
||||
return Container {
|
||||
@@ -2764,12 +2848,12 @@ impl Socket {
|
||||
}
|
||||
#[derive(Serialize, Deserialize, Clone, PartialEq, Debug)]
|
||||
pub enum CacheSharingMode {
|
||||
PRIVATE,
|
||||
LOCKED,
|
||||
SHARED,
|
||||
PRIVATE,
|
||||
}
|
||||
#[derive(Serialize, Deserialize, Clone, PartialEq, Debug)]
|
||||
pub enum NetworkProtocol {
|
||||
UDP,
|
||||
TCP,
|
||||
UDP,
|
||||
}
|
||||
|
@@ -68,6 +68,32 @@ impl Selection {
|
||||
s
|
||||
}
|
||||
|
||||
pub fn arg_enum<S>(&self, name: &str, value: S) -> Selection
|
||||
where
|
||||
S: Serialize,
|
||||
{
|
||||
let mut s = self.clone();
|
||||
|
||||
let val = serde_json::to_string(&value).unwrap();
|
||||
let val = val[1..val.len() - 1].to_string();
|
||||
|
||||
println!("test");
|
||||
println!("{}", val);
|
||||
|
||||
match s.args.as_mut() {
|
||||
Some(args) => {
|
||||
let _ = args.insert(name.to_string(), val);
|
||||
}
|
||||
None => {
|
||||
let mut hm = HashMap::new();
|
||||
let _ = hm.insert(name.to_string(), val);
|
||||
s.args = Some(hm);
|
||||
}
|
||||
}
|
||||
|
||||
s
|
||||
}
|
||||
|
||||
pub fn build(&self) -> eyre::Result<String> {
|
||||
let mut fields = vec!["query".to_string()];
|
||||
|
||||
@@ -76,7 +102,7 @@ impl Selection {
|
||||
if let Some(args) = sel.args {
|
||||
let actualargs = args
|
||||
.iter()
|
||||
.map(|(name, arg)| format!("{name}:{arg}"))
|
||||
.map(|(name, arg)| format!("{name}:{}", arg.as_str()))
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
query = query.add(&format!("({})", actualargs.join(", ")));
|
||||
@@ -99,6 +125,9 @@ impl Selection {
|
||||
{
|
||||
let query = self.build()?;
|
||||
|
||||
let qbs = query.as_str();
|
||||
println!("{}", qbs);
|
||||
|
||||
let resp: Option<serde_json::Value> = match gql_client.query(&query).await {
|
||||
Ok(r) => r,
|
||||
Err(e) => eyre::bail!(e),
|
||||
|
47
crates/dagger-sdk/tests/issues/iss_30.rs
Normal file
47
crates/dagger-sdk/tests/issues/iss_30.rs
Normal file
@@ -0,0 +1,47 @@
|
||||
use dagger_sdk::{QueryContainerOpts, QueryContainerOptsBuilder};
|
||||
|
||||
static PLATFORMS: [&str; 2] = ["linux/arm64", "linux/x86_64"];
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_issue_30_alt() -> eyre::Result<()> {
|
||||
let client = dagger_sdk::connect().await?;
|
||||
|
||||
for platform in PLATFORMS {
|
||||
let ref_ = client
|
||||
.container_opts(QueryContainerOpts {
|
||||
id: None,
|
||||
platform: Some(platform.to_string().into()),
|
||||
})
|
||||
.from("alpine")
|
||||
.with_exec(vec!["echo", "'hello'"])
|
||||
.exit_code()
|
||||
.await?;
|
||||
|
||||
println!("published image to: {:#?}", ref_);
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_issue_30() -> eyre::Result<()> {
|
||||
let client = dagger_sdk::connect().await?;
|
||||
|
||||
for platform in PLATFORMS {
|
||||
let ref_ = client
|
||||
.container_opts(
|
||||
QueryContainerOptsBuilder::default()
|
||||
.platform(platform)
|
||||
.build()
|
||||
.unwrap(),
|
||||
)
|
||||
.from("alpine")
|
||||
.with_exec(vec!["echo", "'hello'"])
|
||||
.exit_code()
|
||||
.await?;
|
||||
|
||||
println!("published image to: {:#?}", ref_);
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
29
crates/dagger-sdk/tests/issues/iss_33.rs
Normal file
29
crates/dagger-sdk/tests/issues/iss_33.rs
Normal file
@@ -0,0 +1,29 @@
|
||||
use dagger_sdk::{ContainerWithExposedPortOpts, NetworkProtocol};
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_issue_30_alt() -> eyre::Result<()> {
|
||||
let client = dagger_sdk::connect().await?;
|
||||
|
||||
client
|
||||
.container()
|
||||
.from("denoland/deno:debian-1.30.3")
|
||||
.with_exposed_port_opts(
|
||||
53,
|
||||
ContainerWithExposedPortOpts {
|
||||
protocol: Some(NetworkProtocol::TCP),
|
||||
description: None,
|
||||
},
|
||||
)
|
||||
.with_exposed_port_opts(
|
||||
53,
|
||||
ContainerWithExposedPortOpts {
|
||||
protocol: Some(NetworkProtocol::UDP),
|
||||
description: None,
|
||||
},
|
||||
)
|
||||
.with_exec(vec!["echo", "hello"])
|
||||
.exit_code()
|
||||
.await?;
|
||||
|
||||
Ok(())
|
||||
}
|
2
crates/dagger-sdk/tests/issues/mod.rs
Normal file
2
crates/dagger-sdk/tests/issues/mod.rs
Normal file
@@ -0,0 +1,2 @@
|
||||
mod iss_30;
|
||||
mod iss_33;
|
@@ -1,3 +1,5 @@
|
||||
mod issues;
|
||||
|
||||
use dagger_sdk::{connect, ContainerExecOptsBuilder};
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
|
Reference in New Issue
Block a user