Skip to content

Commit

Permalink
Integration tests; add #[ignore = "msg"] messages (#1141)
Browse files Browse the repository at this point in the history
* Use rust 1.61 ignore messages in integration tests

also does some slight tweaks to release scripts that had compat issues on mac.
(moving away from gnu tooling in favour of what's listed in kube.rs/tools )

Signed-off-by: clux <sszynrae@gmail.com>

* fmt

Signed-off-by: clux <sszynrae@gmail.com>

---------

Signed-off-by: clux <sszynrae@gmail.com>
  • Loading branch information
clux authored Feb 17, 2023
1 parent 43e6875 commit 9ebd055
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 25 deletions.
6 changes: 3 additions & 3 deletions kube-client/src/api/entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ mod tests {
};

#[tokio::test]
#[ignore] // needs cluster (gets and writes cms)
#[ignore = "needs cluster (gets and writes cms)"]
async fn entry_create_missing_object() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::try_default().await?;
let api = Api::<ConfigMap>::default_namespaced(client);
Expand Down Expand Up @@ -407,7 +407,7 @@ mod tests {
}

#[tokio::test]
#[ignore] // needs cluster (gets and writes cms)
#[ignore = "needs cluster (gets and writes cms)"]
async fn entry_update_existing_object() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::try_default().await?;
let api = Api::<ConfigMap>::default_namespaced(client);
Expand Down Expand Up @@ -478,7 +478,7 @@ mod tests {
}

#[tokio::test]
#[ignore] // needs cluster (gets and writes cms)
#[ignore = "needs cluster (gets and writes cms)"]
async fn entry_create_dry_run() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::try_default().await?;
let api = Api::<ConfigMap>::default_namespaced(client);
Expand Down
4 changes: 2 additions & 2 deletions kube-client/src/api/util/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ mod test {
use serde_json::json;

#[tokio::test]
#[ignore] // needs kubeconfig
#[ignore = "needs kubeconfig"]
async fn node_cordon_and_uncordon_works() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::try_default().await?;

Expand Down Expand Up @@ -105,7 +105,7 @@ mod test {
}

#[tokio::test]
#[ignore] // requires a cluster
#[ignore = "requires a cluster"]
async fn create_token_request() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::try_default().await?;

Expand Down
16 changes: 8 additions & 8 deletions kube-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ mod test {
// hard disabled test atm due to k3d rustls issues: https://github.com/kube-rs/kube/issues?q=is%3Aopen+is%3Aissue+label%3Arustls
#[cfg(feature = "when_rustls_works_with_k3d")]
#[tokio::test]
#[ignore] // needs cluster (lists pods)
#[ignore = "needs cluster (lists pods)"]
#[cfg(all(feature = "rustls-tls"))]
async fn custom_client_rustls_configuration() -> Result<(), Box<dyn std::error::Error>> {
let config = Config::infer().await?;
Expand All @@ -163,7 +163,7 @@ mod test {
}

#[tokio::test]
#[ignore] // needs cluster (lists pods)
#[ignore = "needs cluster (lists pods)"]
#[cfg(all(feature = "openssl-tls"))]
async fn custom_client_openssl_tls_configuration() -> Result<(), Box<dyn std::error::Error>> {
let config = Config::infer().await?;
Expand All @@ -178,7 +178,7 @@ mod test {
}

#[tokio::test]
#[ignore] // needs cluster (lists api resources)
#[ignore = "needs cluster (lists api resources)"]
#[cfg(all(feature = "discovery"))]
async fn group_discovery_oneshot() -> Result<(), Box<dyn std::error::Error>> {
use crate::{core::DynamicObject, discovery};
Expand All @@ -192,7 +192,7 @@ mod test {
}

#[tokio::test]
#[ignore] // needs cluster (will create and edit a pod)
#[ignore = "needs cluster (will create and edit a pod)"]
async fn pod_can_use_core_apis() -> Result<(), Box<dyn std::error::Error>> {
use kube::api::{DeleteParams, ListParams, Patch, PatchParams, PostParams, WatchEvent};

Expand Down Expand Up @@ -272,7 +272,7 @@ mod test {
}

#[tokio::test]
#[ignore] // needs cluster (will create and attach to a pod)
#[ignore = "needs cluster (will create and attach to a pod)"]
#[cfg(all(feature = "ws"))]
async fn pod_can_exec_and_write_to_stdin() -> Result<(), Box<dyn std::error::Error>> {
use crate::api::{DeleteParams, ListParams, Patch, PatchParams, WatchEvent};
Expand Down Expand Up @@ -384,7 +384,7 @@ mod test {
}

#[tokio::test]
#[ignore] // needs cluster (will create and tail logs from a pod)
#[ignore = "needs cluster (will create and tail logs from a pod)"]
async fn can_get_pod_logs_and_evict() -> Result<(), Box<dyn std::error::Error>> {
use crate::{
api::{DeleteParams, EvictParams, ListParams, Patch, PatchParams, WatchEvent},
Expand Down Expand Up @@ -470,7 +470,7 @@ mod test {
}

#[tokio::test]
#[ignore] // requires a cluster
#[ignore = "requires a cluster"]
async fn can_operate_on_pod_metadata() -> Result<(), Box<dyn std::error::Error>> {
use crate::{
api::{DeleteParams, EvictParams, ListParams, Patch, PatchParams, WatchEvent},
Expand Down Expand Up @@ -556,7 +556,7 @@ mod test {
Ok(())
}
#[tokio::test]
#[ignore] // needs cluster (will create a CertificateSigningRequest)
#[ignore = "needs cluster (will create a CertificateSigningRequest)"]
async fn csr_can_be_approved() -> Result<(), Box<dyn std::error::Error>> {
use crate::api::PostParams;
use k8s_openapi::api::certificates::v1::{
Expand Down
4 changes: 2 additions & 2 deletions kube-runtime/src/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ mod test {
use super::{Event, EventType, Recorder};

#[tokio::test]
#[ignore] // needs cluster (creates a pointless event on the kubernetes main service)
#[ignore = "needs cluster (creates an event for the default kubernetes service)"]
async fn event_recorder_attaches_events() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::try_default().await?;

Expand Down Expand Up @@ -278,7 +278,7 @@ mod test {
}

#[tokio::test]
#[ignore] // needs cluster (creates a pointless event on the kubernetes main service)
#[ignore = "needs cluster (creates an event for the default kubernetes service)"]
async fn event_recorder_attaches_events_without_namespace() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::try_default().await?;

Expand Down
1 change: 0 additions & 1 deletion kube-runtime/src/utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ use std::{
use stream::IntoStream;
use tokio::{runtime::Handle, task::JoinHandle};


/// Allows splitting a `Stream` into several streams that each emit a disjoint subset of the input stream's items,
/// like a streaming variant of pattern matching.
///
Expand Down
12 changes: 6 additions & 6 deletions kube/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ mod test {
}

#[tokio::test]
#[ignore] // needs kubeconfig
#[ignore = "needs kubeconfig"]
async fn custom_resource_generates_correct_core_structs() {
use crate::core::{ApiResource, DynamicObject, GroupVersionKind};
let client = Client::try_default().await.unwrap();
Expand All @@ -229,7 +229,7 @@ mod test {
apiextensions_apiserver::pkg::apis::apiextensions::v1::CustomResourceDefinition,
};
#[tokio::test]
#[ignore] // needs cluster (creates + patches foo crd)
#[ignore = "needs cluster (creates + patches foo crd)"]
#[cfg(all(feature = "derive", feature = "runtime"))]
async fn derived_resource_queriable_and_has_subresources() -> Result<(), Box<dyn std::error::Error>> {
use crate::runtime::wait::{await_condition, conditions};
Expand Down Expand Up @@ -305,7 +305,7 @@ mod test {
}

#[tokio::test]
#[ignore] // needs cluster (lists pods)
#[ignore = "needs cluster (lists pods)"]
async fn custom_serialized_objects_are_queryable_and_iterable() -> Result<(), Box<dyn std::error::Error>>
{
use crate::core::{
Expand Down Expand Up @@ -356,7 +356,7 @@ mod test {
}

#[tokio::test]
#[ignore] // needs cluster (fetches api resources, and lists all)
#[ignore = "needs cluster (fetches api resources, and lists all)"]
#[cfg(all(feature = "derive"))]
async fn derived_resources_discoverable() -> Result<(), Box<dyn std::error::Error>> {
use crate::{
Expand Down Expand Up @@ -432,7 +432,7 @@ mod test {
}

#[tokio::test]
#[ignore] // needs cluster (will create await a pod)
#[ignore = "needs cluster (will create await a pod)"]
#[cfg(all(feature = "runtime"))]
async fn pod_can_await_conditions() -> Result<(), Box<dyn std::error::Error>> {
use crate::{
Expand Down Expand Up @@ -514,7 +514,7 @@ mod test {
}

#[tokio::test]
#[ignore] // needs cluster (lists cms)
#[ignore = "needs cluster (lists cms)"]
async fn api_get_opt_handles_404() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::try_default().await?;
let api = Api::<ConfigMap>::default_namespaced(client);
Expand Down
2 changes: 1 addition & 1 deletion scripts/release-post.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ set -euo pipefail

main() {
cd "$(dirname "${BASH_SOURCE[0]}")" && cd .. # aka $WORKSPACE_ROOT
local -r CURRENT_VER="$(rg "kube =" README.md | head -n 1 | awk -F"\"" '{print $2}')"
local -r CURRENT_VER="$(rg "kube =" README.md | head -n 1 | rg 'version = "(\S*)"' -or '$1')"
git tag -a "${CURRENT_VER}" -m "${CURRENT_VER}"
git push
git push --tags
Expand Down
4 changes: 2 additions & 2 deletions scripts/release-pre.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ replace-docs() {
}

sanity() {
CARGO_TREE_OPENAPI="$(cargo tree -i k8s-openapi | head -n 1 | awk '{print $2}')"
CARGO_TREE_OPENAPI="$(cargo tree -i k8s-openapi | head -n 1 | choose 1)"
USED_K8S_OPENAPI="${CARGO_TREE_OPENAPI:1}"
RECOMMENDED_K8S_OPENAPI="$(rg "k8s-openapi =" README.md | head -n 1)" # only check first instance
if ! [[ $RECOMMENDED_K8S_OPENAPI =~ $USED_K8S_OPENAPI ]]; then
Expand All @@ -29,7 +29,7 @@ sanity() {
main() {
# We only want this to run ONCE at workspace level
cd "$(dirname "${BASH_SOURCE[0]}")" && cd .. # aka $WORKSPACE_ROOT
local -r CURRENT_VER="$(rg "kube =" README.md | head -n 1 | awk -F"\"" '{print $2}')"
local -r CURRENT_VER="$(rg "kube =" README.md | head -n 1 | rg 'version = "(\S*)"' -or '$1')"

# If the main README has been bumped, assume we are done:
if [[ "${NEW_VERSION}" = "${CURRENT_VER}" ]]; then
Expand Down

0 comments on commit 9ebd055

Please sign in to comment.