Skip to content

Commit

Permalink
Merge pull request #12962 from torchiaf/12939-fix-node-selector
Browse files Browse the repository at this point in the history
Fix Node Scheduling / Node Name option in Workloads page
  • Loading branch information
torchiaf authored Jan 7, 2025
2 parents 7632c51 + cd73a68 commit 8715067
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 1 deletion.
6 changes: 5 additions & 1 deletion shell/components/form/NodeScheduling.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export default {
type: String,
default: 'create'
},
loading: {
default: false,
type: Boolean
Expand Down Expand Up @@ -169,6 +170,7 @@ export default {
name="selectNode"
:options="selectNodeOptions"
:mode="mode"
:data-testid="'node-scheduling-selectNode'"
@input="update"
/>
</div>
Expand All @@ -182,7 +184,8 @@ export default {
:mode="mode"
:multiple="false"
:loading="loading"
@input="update"
:data-testid="'node-scheduling-nodeSelector'"
@update:value="update"
/>
</div>
</div>
Expand All @@ -191,6 +194,7 @@ export default {
<NodeAffinity
v-model:value="nodeAffinity"
:mode="mode"
:data-testid="'node-scheduling-nodeAffinity'"
@input="update"
/>
</template>
Expand Down
44 changes: 44 additions & 0 deletions shell/components/form/__tests__/NodeScheduling.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { mount } from '@vue/test-utils';
import NodeScheduling from '@shell/components/form/NodeScheduling.vue';
import { _CREATE, _EDIT, _VIEW } from '@shell/config/query-params';

const requiredSetup = () => {
return {
global: {
mocks: {
$store: {
getters: {
currentProduct: { inStore: 'cluster' },
'i18n/t': (text: string) => text,
t: (text: string) => text,
}
}
},
}
};
};

describe('component: NodeScheduling', () => {
const value = { nodeName: 'node-1' };

const nodes = ['node-0', 'node-1'];

it.each([
_VIEW,
_CREATE,
_EDIT
])('should show NodeName option', (mode) => {
const wrapper = mount(
NodeScheduling,
{
props: {
mode, loading: false, value, nodes
},
...requiredSetup(),
}
);

expect(wrapper.find('[data-testid="node-scheduling-selectNode"]').exists()).toBeTruthy();
expect(wrapper.find('[data-testid="node-scheduling-nodeSelector"]').element.textContent).toContain(value.nodeName);
});
});

0 comments on commit 8715067

Please sign in to comment.