Skip to content

Commit

Permalink
Merge release-1.13 back into master (#1285)
Browse files Browse the repository at this point in the history
* Update protos and related use for Dapr 1.13. (#1236)

* Update protos and related use.

Signed-off-by: Phillip Hoff <[email protected]>

* Update Dapr runtime version.

Signed-off-by: Phillip Hoff <[email protected]>

* Init properties.

Signed-off-by: Phillip Hoff <[email protected]>

---------

Signed-off-by: Phillip Hoff <[email protected]>

* Update artifact action versions. (#1240)

Signed-off-by: Phillip Hoff <[email protected]>

* Make recursive true as default (#1243)

Signed-off-by: Shivam Kumar <[email protected]>

* Fix for secret key transformation in multi-value scenarios (#1274)

* Add repro test.

Signed-off-by: Phillip Hoff <[email protected]>

* Fix for secret key transformation in multi-value scenarios.

Signed-off-by: Phillip Hoff <[email protected]>

---------

Signed-off-by: Phillip Hoff <[email protected]>

* Update Dapr version numbers used during testing.

Signed-off-by: Phillip Hoff <[email protected]>

---------

Signed-off-by: Phillip Hoff <[email protected]>
Signed-off-by: Shivam Kumar <[email protected]>
Co-authored-by: Shivam Kumar <[email protected]>
  • Loading branch information
philliphoff and shivamkm07 authored Jun 25, 2024
1 parent 2e94bb1 commit 512c9ea
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 4 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/itests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ jobs:
GOARCH: amd64
GOPROXY: https://proxy.golang.org
DAPR_CLI_VER: 1.13.0
DAPR_RUNTIME_VER: 1.13.0
DAPR_INSTALL_URL: https://raw.githubusercontent.com/dapr/cli/release-1.13/install/install.sh
DAPR_RUNTIME_VER: 1.13.2
DAPR_INSTALL_URL: https://raw.githubusercontent.com/dapr/cli/release-1.12/install/install.sh
DAPR_CLI_REF: ''
steps:
- name: Set up Dapr CLI
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,15 @@ private async Task LoadAsync()
$"A duplicate key '{key}' was found in the secret store '{store}'. Please remove any duplicates from your secret store.");
}

data.Add(normalizeKey ? NormalizeKey(secretDescriptor.SecretName) : secretDescriptor.SecretName,
result[key]);
// The name of the key "as desired" by the user based on the descriptor.
//
// NOTE: This should vary only if a single secret of the same name is returned.
string desiredKey = StringComparer.Ordinal.Equals(key, secretDescriptor.SecretKey) ? secretDescriptor.SecretName : key;

// The name of the key normalized based on the configured delimiters.
string normalizedKey = normalizeKey ? NormalizeKey(desiredKey) : desiredKey;

data.Add(normalizedKey, result[key]);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,35 @@ public void LoadSecrets_FromSecretStoreThatCanReturnsMultipleValues()
config[secondSecretKey].Should().Be(secondSecretValue);
}

[Fact]
public void LoadSecrets_FromSecretStoreThatCanReturnsMultivaluedValues()
{
var storeName = "store";
var parentSecretKey = "connectionStrings";
var firstSecretKey = "first_secret";
var secondSecretKey = "second_secret";
var firstSecretValue = "secret1";
var secondSecretValue = "secret2";

var secretDescriptors = new[]
{
new DaprSecretDescriptor(parentSecretKey)
};

var daprClient = new Mock<DaprClient>();

daprClient.Setup(c => c.GetSecretAsync(storeName, parentSecretKey,
It.IsAny<Dictionary<string, string>>(), default))
.ReturnsAsync(new Dictionary<string, string> { { firstSecretKey, firstSecretValue }, { secondSecretKey, secondSecretValue } });

var config = CreateBuilder()
.AddDaprSecretStore(storeName, secretDescriptors, daprClient.Object)
.Build();

config[firstSecretKey].Should().Be(firstSecretValue);
config[secondSecretKey].Should().Be(secondSecretValue);
}

[Fact]
public void LoadSecrets_FromSecretStoreWithADifferentSecretKeyAndName()
{
Expand Down

0 comments on commit 512c9ea

Please sign in to comment.