Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't seem to get a failed future on delete of non-existent object #336

Open
eswenson1 opened this issue Jan 13, 2022 · 0 comments
Open

Comments

@eswenson1
Copy link

eswenson1 commented Jan 13, 2022

If I do effectively this:

val fut = (k8s usingNamespace namespace delete[ConfigMap] name).map { r => Right(r) }.recover {
      case t: Throwable =>
        Left(t)
    }

    println(Await.result(fut, Duration.Inf))

I can repeatedly execute the above, with no Left(...) ever being returned. The first time, of course, it should succeed, but in subsequent invocations, it should raise an exception.

The corresponding code works fine for create (and other CRUD) operations:

//    val fut = (k8s usingNamespace namespace create configMap).map { r => Right(r) }.recover {
//      case t: Throwable =>
//        Left(t)
//    }

Attempting to invoke more than once will return a Left, such as this one:

Left(skuber.api.client.package$K8SException: Status(v1,Status,ListMeta(,,None),Some(Failure),Some(configmaps "foo22" already exists),Some(AlreadyExists),Some({"name":"foo22","kind":"configmaps"}),Some(409)))

In the case of delete, if the object doesn't exist, we see:

[INFO] [01/13/2022 15:30:00.738] [default-akka.actor.default-dispatcher-4] [skuber.api] [Response: non-ok status returned - Status(v1,Status,ListMeta(,,None),Some(Failure),Some(configmaps "foo22" not found),Some(NotFound),Some({"name":"foo22","kind":"configmaps"}),Some(404))
Right(())

Clearly, the non-200 status (404) is returned, but skuber doesn't appear to raise an exception.

I'm using:

"io.github.hagay3" %% "skuber" % "2.7.0",

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant