grafana / plugin-tools

Create Grafana plugins with ease.
https://grafana.com/developers/plugin-tools/
Apache License 2.0
55 stars 27 forks source link

Plugin E2E: Fix - skip creating user if it's the default server admin #941

Closed sunker closed 1 month ago

sunker commented 1 month ago

What this PR does / why we need it:

This PR fixes an issue related to creating user that was introduced in plugin-e2e@1.3.0 (this PR).

In that PR, user became a Playwright option with a default value of admin:admin. Since the default user is always provided, plugin-e2e would try to create if. Normally this should be fine - if the user already exist, server will return a 412 which will be logged and swallowed by plugin-e2e. However, that doesn't seem to be the case when it's trying to create the server admin account. Then we're getting the following error:

  Error: Could not create user 'admin': {
      "accessErrorId": "ACE8544459724",
      "message": "You'll need additional permissions to perform this action. Permissions needed: users:create",
      "title": "Access denied"
    }

The solution is to not create user if its username and pass matches the default users.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer: Some of the scaffolding tests in CI were failing because they were using the broken 1.3.0 version of plugin-e2e which this PR aims to fix. So I have to pin the plugin-e2e version to 1.2.0 to get those tests to work. Will open a follow up PR that changes version to ^1.3.1 as soon as it's released.

📦 Published PR as canary version: Canary Versions
:sparkles: Test out this PR locally via: ```bash npm install @grafana/create-plugin@4.11.2-canary.941.a7ef49a.0 npm install @grafana/plugin-e2e@1.3.1-canary.941.a7ef49a.0 # or yarn add @grafana/create-plugin@4.11.2-canary.941.a7ef49a.0 yarn add @grafana/plugin-e2e@1.3.1-canary.941.a7ef49a.0 ```
github-actions[bot] commented 1 month ago

Hello! 👋 This repository uses Auto for releasing packages using PR labels.

✨ This PR can be merged and will trigger a new patch release. NOTE: When merging a PR with the release label please avoid merging another PR. For further information see here.

grafana-plugins-platform-bot[bot] commented 1 month ago

:rocket: PR was released in @grafana/create-plugin@4.11.2, @grafana/plugin-e2e@1.3.1 :rocket: