File tree 3 files changed +14
-4
lines changed
main/kotlin/com/redhat/devtools/intellij/kubernetes/model
test/kotlin/com/redhat/devtools/intellij/kubernetes/model
3 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ sinceIdeaBuild=232
5
5
projectVersion =1.2.1-SNAPSHOT
6
6
jetBrainsToken =invalid
7
7
jetBrainsChannel =stable
8
- intellijPluginVersion =1.15 .0
8
+ intellijPluginVersion =1.16 .0
9
9
intellijCommonVersion =1.9.3-SNAPSHOT
10
10
telemetryPluginVersion =1.0.0.44
11
11
kotlin.stdlib.default.dependency = false
Original file line number Diff line number Diff line change @@ -245,12 +245,13 @@ open class AllContexts(
245
245
* The latter gets closed/recreated whenever the context changes in
246
246
* [com.redhat.devtools.intellij.kubernetes.model.client.KubeConfigAdapter].
247
247
*/
248
- val watcher = ConfigWatcher (path) { _, config -> onKubeConfigChanged(config) }
248
+ val watcher = ConfigWatcher (path) { _, config: io.fabric8.kubernetes.api.model. Config ? -> onKubeConfigChanged(config) }
249
249
runAsync(watcher::run)
250
250
}
251
251
252
- protected open fun onKubeConfigChanged (fileConfig : io.fabric8.kubernetes.api.model.Config ) {
252
+ protected open fun onKubeConfigChanged (fileConfig : io.fabric8.kubernetes.api.model.Config ? ) {
253
253
synchronized(this ) {
254
+ fileConfig ? : return
254
255
val client = client.get() ? : return
255
256
val clientConfig = client.config.configuration
256
257
if (ConfigHelper .areEqual(fileConfig, clientConfig)) {
Original file line number Diff line number Diff line change @@ -398,6 +398,15 @@ class AllContextsTest {
398
398
verify(modelChange, never()).fireCurrentNamespaceChanged(anyOrNull(), anyOrNull())
399
399
}
400
400
401
+ @Test
402
+ fun `#onKubeConfigChanged() should NOT fire if new config is null` () {
403
+ // given
404
+ // when
405
+ allContexts.onKubeConfigChanged(null )
406
+ // then
407
+ verify(modelChange, never()).fireAllContextsChanged()
408
+ }
409
+
401
410
@Test
402
411
fun `#onKubeConfigChanged() should NOT fire if existing config and given config are equal` () {
403
412
// given
@@ -550,7 +559,7 @@ class AllContextsTest {
550
559
}
551
560
552
561
/* * override with public method so that it can be tested**/
553
- public override fun onKubeConfigChanged (fileConfig : Config ) {
562
+ public override fun onKubeConfigChanged (fileConfig : Config ? ) {
554
563
super .onKubeConfigChanged(fileConfig)
555
564
}
556
565
You can’t perform that action at this time.
0 commit comments