grafana / redshift-datasource

Apache License 2.0
9 stars 11 forks source link

Fix E2E: Update region before sending the /secrets resource request #280

Closed idastambuk closed 5 months ago

idastambuk commented 6 months ago

We were getting "Missing region" error on /secrets resource request. It looks like the delay between selecting a region and sending a the /secrets request in the test (by clicking on the Managed secret input) is too short. Adding a cy.wait(5000) seems to fix it.

Screenshot 2024-05-29 at 19 00 52

Tried decreasing it to 2000 ms but looks like that's still too short. It's probably not the best or foolproof solution, but we will be migrating eventually to plugin-e2e

idastambuk commented 5 months ago

If the region request is taking longer than 2 seconds, do you think it would be better to move/copy the hardcoded list to the frontend?

Is the issue that the regions list isn't populating yet or is the issue that we need to wait for an update to be made select a region?

It sounds like we can just type any region into the input field, so I wouldn't think we'd need to wait to populate the list.

If the issue is we need to wait for an update to the region, I wonder if we can take anything filled out in progress and use that for the secrets request? That said if we want to revisit why this is slow in another pr and just fix the build here, I think that's an ok call to make.

Hmm I think I didn't explain it well, sorry! My theory theory is that when we select/write the region, it isn't updated in the datasource, so when we request the managedSecret resource (in the test, it's pretty quick), it's still empty. It doesn't look like we currently have much control over what we pass to the resource request in the test.

@iwysiu that's a good suggestion, but I'd rather merge this to fix the build, then see if we need to do that when we migrate to plugin-e2e, if that sounds good?