Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Config element mocking is broken in BT 2.34.0 #149

Closed
pe1pip opened this issue Jul 13, 2023 · 9 comments
Closed

Config element mocking is broken in BT 2.34.0 #149

pe1pip opened this issue Jul 13, 2023 · 9 comments
Assignees
Labels

Comments

@pe1pip
Copy link
Contributor

pe1pip commented Jul 13, 2023

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

Copy link

github-actions bot commented Jan 4, 2024

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 github-actions bot added the Stale label Jan 4, 2024
@VenelinBakalov
Copy link
Contributor

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

@github-actions github-actions bot removed the Stale label Jan 6, 2024
@RadoslavKK RadoslavKK self-assigned this Jan 11, 2024
Copy link

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 github-actions bot added the Stale label Feb 11, 2024
@VenelinBakalov
Copy link
Contributor

@Michaelpalacce reminder to check if this is still valid

@github-actions github-actions bot removed the Stale label Feb 13, 2024
@pe1pip
Copy link
Contributor Author

pe1pip commented Mar 13, 2024 via email

@pe1pip
Copy link
Contributor Author

pe1pip commented Mar 25, 2024

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.

Copy link

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 github-actions bot added the Stale label Apr 25, 2024
@VenelinBakalov
Copy link
Contributor

Not stale, there is a PR open with discussion:
#265

@github-actions github-actions bot removed the Stale label Apr 26, 2024
@pe1pip
Copy link
Contributor Author

pe1pip commented May 23, 2024

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

@pe1pip pe1pip closed this as completed May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

5 participants