Skip to content

Commit

Permalink
Fixes some problems with latest dependency updates (gardener#2000)
Browse files Browse the repository at this point in the history
* fix and update constraints

* fix composable tests

* fixed vitest setup

* update vitest

* update vueuse and allow beta releases

* hopefully fixed issue with update cookies after finished tests

* fixed some more tests

* remove effectScope from tests (does not solve the problem)

* mock cookieStore on window

* downgrade eslint-plugin-promise and dedupe
  • Loading branch information
holgerkoser authored Jul 24, 2024
1 parent 4fbcf24 commit cf78824
Show file tree
Hide file tree
Showing 170 changed files with 1,031 additions and 2,849 deletions.
1,800 changes: 449 additions & 1,351 deletions .pnp.cjs

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed .yarn/cache/has-npm-1.0.3-b7f00631c1-e1da0d2bd1.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed .yarn/cache/ufo-npm-1.3.2-dcaf8105d0-180f3dfcdf.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
3 changes: 0 additions & 3 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ packageExtensions:
"@vueuse/shared@*":
peerDependencies:
vue: "*"
local-pkg@*:
dependencies:
jsdom: "*"
splitpanes@*:
dependencies:
vue: "*"
Expand Down
4 changes: 2 additions & 2 deletions backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jest": "^26.9.0",
"eslint-plugin-n": "^15.7.0",
"eslint-plugin-promise": "^7.0.0",
"eslint-plugin-promise": "^6.4.0",
"fast-json-patch": "^3.1.1",
"jest": "^29.7.0",
"p-event": "^4.2.0",
Expand Down Expand Up @@ -155,6 +155,6 @@
},
"packageManager": "[email protected]",
"engines": {
"node": "^20.5.0"
"node": "^20.9.0"
}
}
4 changes: 2 additions & 2 deletions charts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jest": "^26.9.0",
"eslint-plugin-n": "^15.7.0",
"eslint-plugin-promise": "^7.0.0",
"eslint-plugin-promise": "^6.4.0",
"jest": "^29.7.0",
"js-yaml": "^4.1.0",
"lodash": "^4.17.21"
Expand Down Expand Up @@ -64,6 +64,6 @@
},
"packageManager": "[email protected]",
"engines": {
"node": "^20.5.0"
"node": "^20.9.0"
}
}
65 changes: 40 additions & 25 deletions frontend/__tests__/components/GStatusTag.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,27 @@
//

import { mount } from '@vue/test-utils'
import { createTestingPinia } from '@pinia/testing'
import { createPinia } from 'pinia'

import { useAuthnStore } from '@/store/authn'

import GStatusTag from '@/components/GStatusTag.vue'

const { createVuetifyPlugin } = global.fixtures.helper

describe('components', () => {
describe('g-status-tag', () => {
function mountStatusTag (condition, isAdmin = false) {
const vuetifyPlugin = createVuetifyPlugin()

let pinia
let authnStore

function mountStatusTag (condition) {
return mount(GStatusTag, {
global: {
plugins: [
createVuetifyPlugin(),
createTestingPinia({
initialState: {
authn: {
user: {
email: '[email protected]',
isAdmin,
},
},
},
}),
vuetifyPlugin,
pinia,
],
},
props: {
Expand All @@ -36,12 +34,22 @@ describe('components', () => {
})
}

beforeEach(() => {
pinia = createPinia()
authnStore = useAuthnStore(pinia)
authnStore.user = {
email: '[email protected]',
isAdmin: false,
}
})

it('should render healthy condition object', () => {
const wrapper = mountStatusTag({
shortName: 'foo',
name: 'foo-bar',
status: 'True',
}, true)
})
authnStore.user.isAdmin = true
const vm = wrapper.vm
expect(vm.chipText).toBe('foo')
expect(vm.chipStatus).toBe('Healthy')
Expand Down Expand Up @@ -71,28 +79,35 @@ describe('components', () => {
expect(vm.visible).toBe(true)
})

it('should render accoring to admin status', () => {
const condition = {
it('should render condition for a user without admin role', () => {
const wrapper = mountStatusTag({
shortName: 'foo',
name: 'foo-bar',
status: 'Progressing',
showAdminOnly: true,
}
let wrapper = mountStatusTag(condition)
})
const vm = wrapper.vm
expect(vm.visible).toBe(false)
expect(vm.isProgressing).toBe(true)
expect(vm.color).toBe('primary')
expect(vm.chipStatus).toBe('Progressing')
expect(vm.chipIcon).toBe('')
})

wrapper = mountStatusTag(condition, true)
const vmAdmin = wrapper.vm
expect(vmAdmin.visible).toBe(true)
expect(vmAdmin.isProgressing).toBe(true)
expect(vmAdmin.color).toBe('info')
expect(vmAdmin.chipStatus).toBe('Progressing')
expect(vmAdmin.chipIcon).toBe('mdi-progress-alert')
it('should render condition for a user with admin role', () => {
const wrapper = mountStatusTag({
shortName: 'foo',
name: 'foo-bar',
status: 'Progressing',
showAdminOnly: true,
})
authnStore.user.isAdmin = true
const vm = wrapper.vm
expect(vm.visible).toBe(true)
expect(vm.isProgressing).toBe(true)
expect(vm.color).toBe('info')
expect(vm.chipStatus).toBe('Progressing')
expect(vm.chipIcon).toBe('mdi-progress-alert')
})
})
})
110 changes: 74 additions & 36 deletions frontend/__tests__/components/GStatusTags.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { mount } from '@vue/test-utils'
import { createTestingPinia } from '@pinia/testing'

import { useConfigStore } from '@/store/config'
import { useAuthnStore } from '@/store/authn'

import GStatusTags from '@/components/GStatusTags'

Expand All @@ -18,6 +19,8 @@ const { createVuetifyPlugin } = global.fixtures.helper

describe('components', () => {
describe('g-status-tags', () => {
const lastTransitionTime = 'last-transition-time'

let pinia

function mountStatusTags (conditionTypes) {
Expand All @@ -26,7 +29,7 @@ describe('components', () => {
conditions: conditionTypes.map(type => {
return {
type,
lastTransitionTime: 'foo-transition-time',
lastTransitionTime,
}
}),
},
Expand All @@ -40,14 +43,16 @@ describe('components', () => {
provide: {
'shoot-item': createShootItemComposable(shootItem),
},
stubs: {
GStatusTag: true,
},
},
})
}

beforeEach(() => {
pinia = createTestingPinia({
stubActions: false,
})
pinia = createTestingPinia({ stubActions: false })
const authnStore = useAuthnStore(pinia) // eslint-disable-line no-unused-vars
const configStore = useConfigStore(pinia)
configStore.knownConditions = {
ControlPlaneHealthy: {
Expand All @@ -71,62 +76,95 @@ describe('components', () => {
})

it('should generate condition object for simple condition type', () => {
const wrapper = mountStatusTags(['SampleConditionAvailability'])
const type = 'SampleConditionAvailability'
const wrapper = mountStatusTags([type])
const condition = wrapper.vm.conditions[0]
expect(condition.shortName).toBe('SC')
expect(condition.name).toBe('Sample Condition')
expect(condition.description).toBeUndefined()
expect(condition).toEqual({
type,
lastTransitionTime,
shortName: 'SC',
name: 'Sample Condition',
sortOrder: '000000SC',
})
})

it('should generate condition object for long condition type', () => {
const wrapper = mountStatusTags(['ExtraLongSampleTESTConditionAvailable'])
const type = 'ExtraLongSampleTESTConditionAvailable'
const wrapper = mountStatusTags([type])
const condition = wrapper.vm.conditions[0]
expect(condition.shortName).toBe('ELSTC')
expect(condition.name).toBe('Extra Long Sample TEST Condition')
expect(condition.description).toBeUndefined()
expect(condition).toEqual({
type,
lastTransitionTime,
shortName: 'ELSTC',
name: 'Extra Long Sample TEST Condition',
sortOrder: '000ELSTC',
})
})

it('should generate condition object for single condition type', () => {
const wrapper = mountStatusTags(['Singlecondition'])
const type = 'Singlecondition'
const wrapper = mountStatusTags([type])
const condition = wrapper.vm.conditions[0]
expect(condition.shortName).toBe('S')
expect(condition.name).toBe('Singlecondition')
expect(condition.description).toBeUndefined()
expect(condition).toEqual({
type,
lastTransitionTime,
shortName: 'S',
name: 'Singlecondition',
sortOrder: '0000000S',
})
})

it('should return condition object for known condition types', () => {
const wrapper = mountStatusTags(['APIServerAvailable'])
const type = 'APIServerAvailable'
const wrapper = mountStatusTags([type])
const condition = wrapper.vm.conditions[0]
expect(condition.shortName).toBe('API')
expect(condition.name).toBe('API Server')
expect(condition.sortOrder).toBe('00000000')
expect(condition.description).not.toHaveLength(0)
expect(condition).toEqual({
type,
lastTransitionTime,
shortName: 'API',
name: 'API Server',
sortOrder: '00000000',
description: expect.stringContaining('kube-apiserver'),
})
})

it('should return condition object for condition types loaded from config', () => {
const wrapper = mountStatusTags(['ConditionFromConfigAvailability'])
const type = 'ConditionFromConfigAvailability'
const wrapper = mountStatusTags([type])
const condition = wrapper.vm.conditions[0]
expect(condition.shortName).toBe('CC')
expect(condition.name).toBe('Config Condition')
expect(condition.description).toBe('Config Condition Description')
expect(condition).toEqual({
type,
lastTransitionTime,
shortName: 'CC',
name: 'Config Condition',
sortOrder: '00000000',
description: 'Config Condition Description',
})
})

it('should return overwritten known condition with values from config', () => {
const wrapper = mountStatusTags(['ControlPlaneHealthy'])
const type = 'ControlPlaneHealthy'
const wrapper = mountStatusTags([type])
const condition = wrapper.vm.conditions[0]
expect(condition.shortName).toBe('CPO')
expect(condition.name).toBe('Control Plane Overwritten')
expect(condition.sortOrder).toBe('00000011')
expect(condition.description).toBe('Overwritten Description')
expect(condition).toMatchObject({
type,
lastTransitionTime,
shortName: 'CPO',
name: 'Control Plane Overwritten',
sortOrder: '00000011',
description: 'Overwritten Description',
})
})

it('should return conditions sorted by sortOrder and shortname', () => {
const wrapper = mountStatusTags(['ControlPlaneHealthy', 'DE', 'CE', 'ImportantCondition'])
const [first, second, third, fourth] = wrapper.vm.conditions
expect(first.shortName).toBe('IC')
expect(second.shortName).toBe('C')
expect(third.shortName).toBe('D')
expect(fourth.shortName).toBe('CPO')
const wrapper = mountStatusTags([
'ControlPlaneHealthy',
'DE',
'CE',
'ImportantCondition',
])
const shortNames = wrapper.vm.conditions.map(condition => condition.shortName)
expect(shortNames).toEqual(['IC', 'C', 'D', 'CPO'])
})
})
})
Loading

0 comments on commit cf78824

Please sign in to comment.