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

fix: ensure versionPromise always completes #1155

Merged
merged 4 commits into from May 25, 2023

Conversation

octonato
Copy link
Member

Noticed today with @franciscolopezsancho, that the versionPromise may never complete forcing users to do some weird future gymnastics to work it around.

import org.scalatest.BeforeAndAfterEach

import scala.concurrent.duration._

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code here moved to KubernetesApiSpec because it's only testing KubernetesApi.

AppVersionRevisionSpec is not testing the failure case inside AppVersionRevision.start

s"Be sure to provide the pod name with `$configPath.pod-name` " +
"or by setting ENV variable `KUBERNETES_POD_NAME`."
log.error(msg)
versionPromise.failure(new IllegalStateException(msg))
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If podname is not set, there is nothing else we can do, but if we try to later use getRevision we get a Future that never completes.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, maybe we should not return an IllegalStateException, because it's not illegal. It's just missing info causing a degraded state.

Copy link
Member Author

@octonato octonato May 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, fixed in d7eb68c

Copy link
Member

@patriknw patriknw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good but question about the test

class AppVersionRevisionSpec
extends TestKit(
ActorSystem(
"AppVersionRevisionSpec",
AppVersionRevisionSpec.config
KubernetesApiSpec.config
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't this wrong?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, that's wrong. Copy-n-pasta wrong.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

It turns out that tests were passing even without using the right config. Which makes sense because podname defaults to empty in the reference.conf.

Anyway, I keep the new config just to make it very explicit, but did some clean-up as well.

@octonato octonato force-pushed the octonato/complete-revision-promise-on-failure branch from d02414b to 04681f8 Compare May 24, 2023 19:18
Copy link
Member

@patriknw patriknw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@patriknw patriknw merged commit d762833 into main May 25, 2023
13 checks passed
@patriknw patriknw deleted the octonato/complete-revision-promise-on-failure branch May 25, 2023 09:30
@patriknw patriknw added this to the 1.4.1 milestone May 25, 2023
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

Successfully merging this pull request may close these issues.

None yet

2 participants