build-tools-for-vmware-aria icon indicating copy to clipboard operation
build-tools-for-vmware-aria copied to clipboard

Config element mocking is broken in BT 2.34.0

Open pe1pip opened this issue 2 years ago • 8 comments

Description

@Michaelpalacce it seems you actually broke more than you fixed. Following test (demo.test.ts) works as expected in 2.33.0, but throws in 2.34.0:

Steps to Reproduce

function getConfigurationElementByPath (path: string, name: string): ConfigurationElement {
  const configurationElementCategory = Server.getConfigurationElementCategoryWithPath(path)
  const configurationElements = configurationElementCategory.allConfigurationElements

  const configurationElement = configurationElements.filter(function (configurationElement) {
    return configurationElement.name === name
  })

  if (configurationElement.length !== 1) {
    throw new Error('too many or zero matches')
  }
  return configurationElement[0]
}

function demo (): string {
  const environment = getConfigurationElementByPath('web-root', 'Environment')
  return `demo${environment.getAttributeWithKey('demo').value as string}`
}

describe('demo test', () => {
  beforeEach(() => {
    const envCfg = Server.createConfigurationElement('web-root', 'Environment')
    envCfg.setAttributeWithKey('demo', 'Mock', 'string')
  })
  afterEach(() => {
    Server.removeConfigurationElementCategory(Server.getConfigurationElementCategoryWithPath('web-root')) // cleanup all cfgElements
  })
  it('x', () => {
    expect(demo()).toBe('demoMock')
  })
})

Expected behavior:

expected behaviour is environment.getAttributeWithKey('demo').value to equal 'Mock', but environment.getAttributeWithKey() returns null, even if the attribute exists.

Reproduces how often:

100%

Environment

Client

  • Build Tools for VMware Aria Version: 2.34.0
  • Visual Studio Code Version: n/a
  • OS Version: Windows & MacOs

Server

  • vRealize Automation Version: n/a
  • vRealize Orchestrator Version: n/a
  • vRealize Operations Version: n/a
  • vRealize Log Insight Version: n/a

Failure Logs

Related issues and PRs

#110

pe1pip avatar Jul 13 '23 06:07 pe1pip

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Jan 04 '24 15:01 github-actions[bot]

@Michaelpalacce just to check, this requirement is still valid, right?

VenelinBakalov avatar Jan 04 '24 15:01 VenelinBakalov

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Feb 11 '24 01:02 github-actions[bot]

@Michaelpalacce reminder to check if this is still valid

VenelinBakalov avatar Feb 12 '24 08:02 VenelinBakalov

Hi,

I think it is.

pe1pip avatar Mar 13 '24 08:03 pe1pip

Hi Guys,

sorry for responding so slowly... I just did a few tests and can confirm that this is still an issue with 2.37. Basically, cfg el mocking is broken in all 2.34 and up.

pe1pip avatar Mar 25 '24 13:03 pe1pip

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Apr 25 '24 02:04 github-actions[bot]

Not stale, there is a PR open with discussion: https://github.com/vmware/build-tools-for-vmware-aria/pull/265

VenelinBakalov avatar Apr 25 '24 07:04 VenelinBakalov

I think my PR has been merged, meaning that this issue is now resolved.

pe1pip avatar May 23 '24 11:05 pe1pip