Skip to content

Commit

Permalink
test: add e2e
Browse files Browse the repository at this point in the history
Signed-off-by: Junjie Gao <[email protected]>
  • Loading branch information
JeyJeyGao committed Mar 28, 2024
1 parent f70be2c commit 6135d88
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ public class CredentialsTests
[Theory]
[InlineData("default")]
[InlineData("environment")]
[InlineData("workloadidentity")]
[InlineData("managedidentity")]
[InlineData("workloadid")]
[InlineData("managedid")]
[InlineData("azurecli")]
public void GetCredentials_WithValidCredentialType_ReturnsExpectedCredential(string credentialType)
{
Expand Down
4 changes: 2 additions & 2 deletions Notation.Plugin.AzureKeyVault/KeyVault/Credentials.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ public class Credentials
/// <summary>
/// Workload identity credential name.
/// </summary>
public const string WorkloadIdentityCredentialName = "workloadidentity";
public const string WorkloadIdentityCredentialName = "workloadid";
/// <summary>
/// Managed identity credential name.
/// </summary>
public const string ManagedIdentityCredentialName = "managedidentity";
public const string ManagedIdentityCredentialName = "managedid";
/// <summary>
/// Azure CLI credential name.
/// </summary>
Expand Down
76 changes: 75 additions & 1 deletion test/e2e/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -181,4 +181,78 @@ runs:
run: |
echo "both self signed and ca certs plugin config exist should failed, but succeeded."
exit 1
shell: bash
shell: bash

# credential type test
- name: enviroment credential failed
continue-on-error: true
id: enviroment-credential-failed
uses: notaryproject/notation-action/sign@v1
with:
plugin_name: azure-kv
plugin_url: ${{ inputs.pluginDownloadURL }}
plugin_checksum: ${{ inputs.pluginChecksum }}
key_id: https://acrci-test-kv.vault.azure.net/keys/self-signed-pkcs12/70747b2064c0488e936eba7a29acc4c6
target_artifact_reference: localhost:5000/hello-world:v1
signature_format: cose
plugin_config: |
credential_type=environment
self_signed=true
- name: 'Should Fail: enviroment credential failed'
if: steps.enviroment-credential-failed.outcome != 'failure'
run: |
echo "enviroment credential failed should failed, but succeeded."
exit 1
shell: bash
- name: workload identity failed
continue-on-error: true
id: workload-identity-failed
uses: notaryproject/notation-action/sign@v1
with:
plugin_name: azure-kv
plugin_url: ${{ inputs.pluginDownloadURL }}
plugin_checksum: ${{ inputs.pluginChecksum }}
key_id: https://acrci-test-kv.vault.azure.net/keys/self-signed-pkcs12/70747b2064c0488e936eba7a29acc4c6
target_artifact_reference: localhost:5000/hello-world:v1
signature_format: cose
plugin_config: |
credential_type=workloadid
self_signed=true
- name: 'Should Fail: workload identity failed'
if: steps.workload-identity-failed.outcome != 'failure'
run: |
echo "workload identity failed should failed, but succeeded."
exit 1
shell: bash
- name: managed identity failed
continue-on-error: true
id: managed-identity-failed
uses: notaryproject/notation-action/sign@v1
with:
plugin_name: azure-kv
plugin_url: ${{ inputs.pluginDownloadURL }}
plugin_checksum: ${{ inputs.pluginChecksum }}
key_id: https://acrci-test-kv.vault.azure.net/keys/self-signed-pkcs12/70747b2064c0488e936eba7a29acc4c6
target_artifact_reference: localhost:5000/hello-world:v1
signature_format: cose
plugin_config: |
credential_type=managedid
self_signed=true
- name: 'Should Fail: managed identity failed'
if: steps.managed-identity-failed.outcome != 'failure'
run: |
echo "managed identity failed should failed, but succeeded."
exit 1
shell: bash
- name: azure cli succeeded
uses: notaryproject/notation-action/sign@v1
with:
plugin_name: azure-kv
plugin_url: ${{ inputs.pluginDownloadURL }}
plugin_checksum: ${{ inputs.pluginChecksum }}
key_id: https://acrci-test-kv.vault.azure.net/keys/self-signed-pkcs12/70747b2064c0488e936eba7a29acc4c6
target_artifact_reference: localhost:5000/hello-world:v1
signature_format: cose
plugin_config: |
credential_type=azurecli
self_signed=true

0 comments on commit 6135d88

Please sign in to comment.