|
1 | 1 | // |
2 | 2 | // DISCLAIMER |
3 | 3 | // |
4 | | -// Copyright 2024 ArangoDB GmbH, Cologne, Germany |
| 4 | +// Copyright 2024-2025 ArangoDB GmbH, Cologne, Germany |
5 | 5 | // |
6 | 6 | // Licensed under the Apache License, Version 2.0 (the "License"); |
7 | 7 | // you may not use this file except in compliance with the License. |
@@ -720,6 +720,31 @@ func Test_Scheduling_Tolerations(t *testing.T) { |
720 | 720 | require.EqualValues(t, 5, *pod.Spec.Tolerations[0].TolerationSeconds) |
721 | 721 | }) |
722 | 722 | }) |
| 723 | + t.Run("Multi - Join", func(t *testing.T) { |
| 724 | + applyScheduling(t, nil, &Scheduling{ |
| 725 | + Tolerations: Tolerations{ |
| 726 | + { |
| 727 | + Key: "A", |
| 728 | + Operator: core.TolerationOpExists, |
| 729 | + }, |
| 730 | + }, |
| 731 | + }, &Scheduling{ |
| 732 | + Tolerations: Tolerations{ |
| 733 | + { |
| 734 | + Key: "B", |
| 735 | + Operator: core.TolerationOpExists, |
| 736 | + }, |
| 737 | + }, |
| 738 | + })(func(t *testing.T, pod *core.PodTemplateSpec) { |
| 739 | + require.Len(t, pod.Spec.Tolerations, 2) |
| 740 | + |
| 741 | + require.EqualValues(t, core.TolerationOpExists, pod.Spec.Tolerations[0].Operator) |
| 742 | + require.EqualValues(t, "A", pod.Spec.Tolerations[0].Key) |
| 743 | + |
| 744 | + require.EqualValues(t, core.TolerationOpExists, pod.Spec.Tolerations[1].Operator) |
| 745 | + require.EqualValues(t, "B", pod.Spec.Tolerations[1].Key) |
| 746 | + }) |
| 747 | + }) |
723 | 748 | t.Run("Multi - Update", func(t *testing.T) { |
724 | 749 | applyScheduling(t, nil, &Scheduling{ |
725 | 750 | Tolerations: Tolerations{ |
@@ -806,6 +831,23 @@ func Test_Scheduling_NodeSelector(t *testing.T) { |
806 | 831 | require.Contains(t, pod.Spec.NodeSelector, "1") |
807 | 832 | require.EqualValues(t, pod.Spec.NodeSelector["1"], "2") |
808 | 833 |
|
| 834 | + require.Contains(t, pod.Spec.NodeSelector, "2") |
| 835 | + require.EqualValues(t, pod.Spec.NodeSelector["2"], "1") |
| 836 | + }) |
| 837 | + }) |
| 838 | + t.Run("Remove", func(t *testing.T) { |
| 839 | + applyScheduling(t, nil, &Scheduling{ |
| 840 | + NodeSelector: map[string]string{ |
| 841 | + "1": "1", |
| 842 | + }, |
| 843 | + }, &Scheduling{ |
| 844 | + NodeSelector: map[string]string{ |
| 845 | + "2": "1", |
| 846 | + "1": "-", |
| 847 | + }, |
| 848 | + })(func(t *testing.T, pod *core.PodTemplateSpec) { |
| 849 | + require.Len(t, pod.Spec.NodeSelector, 1) |
| 850 | + |
809 | 851 | require.Contains(t, pod.Spec.NodeSelector, "2") |
810 | 852 | require.EqualValues(t, pod.Spec.NodeSelector["2"], "1") |
811 | 853 | }) |
|
0 commit comments