Skip to content

Commit

Permalink
Merge pull request #833 from berndverst/master-release-1.5-merge
Browse files Browse the repository at this point in the history
Merge release 1.5 into master
  • Loading branch information
berndverst authored Nov 12, 2021
2 parents 1c5e1b3 + 39f1fae commit 20c3640
Show file tree
Hide file tree
Showing 9 changed files with 482 additions and 333 deletions.
10 changes: 7 additions & 3 deletions cmd/invoke.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,13 @@ dapr invoke --unix-domain-socket --app-id target --method sample --verb GET
client := standalone.NewClient()

// TODO(@daixiang0): add Windows support
if runtime.GOOS == "windows" && invokeSocket != "" {
print.FailureStatusEvent(os.Stderr, "unix-domain-socket option still does not support Windows!")
os.Exit(1)
if invokeSocket != "" {
if runtime.GOOS == "windows" {
print.FailureStatusEvent(os.Stderr, "The unix-domain-socket option is not supported on Windows")
os.Exit(1)
} else {
print.WarningStatusEvent(os.Stdout, "Unix domain sockets are currently a preview feature")
}
}

response, err := client.Invoke(invokeAppID, invokeAppMethod, bytePayload, invokeVerb, invokeSocket)
Expand Down
10 changes: 7 additions & 3 deletions cmd/publish.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,13 @@ dapr publish --enable-domain-socket --publish-app-id myapp --pubsub target --top

client := standalone.NewClient()
// TODO(@daixiang0): add Windows support
if runtime.GOOS == "windows" && publishSocket != "" {
print.FailureStatusEvent(os.Stderr, "unix-domain-socket option still does not support Windows!")
os.Exit(1)
if publishSocket != "" {
if runtime.GOOS == "windows" {
print.FailureStatusEvent(os.Stderr, "The unix-domain-socket option is not supported on Windows")
os.Exit(1)
} else {
print.WarningStatusEvent(os.Stdout, "Unix domain sockets are currently a preview feature")
}
}
err = client.Publish(publishAppID, pubsubName, publishTopic, bytePayload, publishSocket)
if err != nil {
Expand Down
3 changes: 2 additions & 1 deletion cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,11 @@ var RunCmd = &cobra.Command{
if unixDomainSocket != "" {
// TODO(@daixiang0): add Windows support
if runtime.GOOS == "windows" {
print.FailureStatusEvent(os.Stderr, "unix-domain-socket option still does not support Windows!")
print.FailureStatusEvent(os.Stderr, "The unix-domain-socket option is not supported on Windows")
os.Exit(1)
} else {
// use unix domain socket means no port any more
print.WarningStatusEvent(os.Stdout, "Unix domain sockets are currently a preview feature")
port = 0
grpcPort = 0
}
Expand Down
16 changes: 7 additions & 9 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@ go 1.16

require (
github.com/Pallinder/sillyname-go v0.0.0-20130730142914-97aeae9e6ba1
github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d // indirect
github.com/briandowns/spinner v1.6.1
github.com/dapr/dapr v1.0.0-rc.1.0.20201217002310-310e670d987b
github.com/dapr/dapr v1.5.0-rc.3
github.com/dapr/go-sdk v1.0.0
github.com/docker/docker v17.12.0-ce-rc1.0.20200618181300-9dc6525e6118+incompatible
github.com/docker/docker v17.12.0-ce-rc1.0.20200916142827-bd33bbf0497b+incompatible
github.com/emicklei/go-restful v2.10.0+incompatible // indirect
github.com/fatih/color v1.10.0
github.com/go-ole/go-ole v1.2.4 // indirect
github.com/garyburd/redigo v1.6.0 // indirect
github.com/gocarina/gocsv v0.0.0-20190426105157-2fc85fcf0c07
github.com/google/go-cmp v0.5.5 // indirect
github.com/hashicorp/go-retryablehttp v0.5.3
github.com/hashicorp/go-version v1.3.0
github.com/mattn/go-runewidth v0.0.8 // indirect
Expand All @@ -22,12 +21,11 @@ require (
github.com/phayes/freeport v0.0.0-20180830031419-95f893ade6f2
github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4
github.com/shirou/gopsutil v3.21.4+incompatible
github.com/spf13/cobra v1.1.1
github.com/spf13/cobra v1.1.3
github.com/spf13/viper v1.7.0
github.com/stretchr/testify v1.7.0
github.com/tklauser/go-sysconf v0.3.6 // indirect
golang.org/x/sys v0.0.0-20210319071255-635bc2c9138d
gopkg.in/yaml.v2 v2.3.0
golang.org/x/sys v0.0.0-20210616094352-59db8d763f22
gopkg.in/yaml.v2 v2.4.0
helm.sh/helm/v3 v3.5.3
k8s.io/api v0.20.2
k8s.io/apiextensions-apiserver v0.20.2
Expand Down
620 changes: 386 additions & 234 deletions go.sum

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions pkg/kubernetes/configurations_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func TestConfigurations(t *testing.T) {
name: "Yaml one config",
configName: "",
outputFormat: "yaml",
expectedOutput: "name: appConfig\nspec:\n httppipelinespec:\n handlers: []\n tracingspec:\n samplingrate: \"\"\n zipkin:\n endpointaddresss: \"\"\n metricspec:\n enabled: false\n mtlsspec:\n enabled: false\n workloadcertttl: \"\"\n allowedclockskew: \"\"\n secrets:\n scopes: []\n accesscontrolspec:\n defaultAction: \"\"\n trustDomain: \"\"\n policies: []\n",
expectedOutput: "name: appConfig\nspec:\n httppipelinespec:\n handlers: []\n tracingspec:\n samplingrate: \"\"\n zipkin:\n endpointaddresss: \"\"\n metricspec:\n enabled: false\n mtlsspec:\n enabled: false\n workloadcertttl: \"\"\n allowedclockskew: \"\"\n secrets:\n scopes: []\n accesscontrolspec:\n defaultAction: \"\"\n trustDomain: \"\"\n policies: []\n nameresolutionspec:\n component: \"\"\n version: \"\"\n configuration:\n json:\n raw: []\n features: []\n apispec:\n allowed: []\n",
errString: "",
errorExpected: false,
k8sConfig: []v1alpha1.Configuration{
Expand All @@ -133,7 +133,7 @@ func TestConfigurations(t *testing.T) {
name: "Yaml two configs",
configName: "",
outputFormat: "yaml",
expectedOutput: "- name: appConfig1\n spec:\n httppipelinespec:\n handlers: []\n tracingspec:\n samplingrate: \"\"\n zipkin:\n endpointaddresss: \"\"\n metricspec:\n enabled: false\n mtlsspec:\n enabled: false\n workloadcertttl: \"\"\n allowedclockskew: \"\"\n secrets:\n scopes: []\n accesscontrolspec:\n defaultAction: \"\"\n trustDomain: \"\"\n policies: []\n- name: appConfig2\n spec:\n httppipelinespec:\n handlers: []\n tracingspec:\n samplingrate: \"\"\n zipkin:\n endpointaddresss: \"\"\n metricspec:\n enabled: false\n mtlsspec:\n enabled: false\n workloadcertttl: \"\"\n allowedclockskew: \"\"\n secrets:\n scopes: []\n accesscontrolspec:\n defaultAction: \"\"\n trustDomain: \"\"\n policies: []\n",
expectedOutput: "- name: appConfig1\n spec:\n httppipelinespec:\n handlers: []\n tracingspec:\n samplingrate: \"\"\n zipkin:\n endpointaddresss: \"\"\n metricspec:\n enabled: false\n mtlsspec:\n enabled: false\n workloadcertttl: \"\"\n allowedclockskew: \"\"\n secrets:\n scopes: []\n accesscontrolspec:\n defaultAction: \"\"\n trustDomain: \"\"\n policies: []\n nameresolutionspec:\n component: \"\"\n version: \"\"\n configuration:\n json:\n raw: []\n features: []\n apispec:\n allowed: []\n- name: appConfig2\n spec:\n httppipelinespec:\n handlers: []\n tracingspec:\n samplingrate: \"\"\n zipkin:\n endpointaddresss: \"\"\n metricspec:\n enabled: false\n mtlsspec:\n enabled: false\n workloadcertttl: \"\"\n allowedclockskew: \"\"\n secrets:\n scopes: []\n accesscontrolspec:\n defaultAction: \"\"\n trustDomain: \"\"\n policies: []\n nameresolutionspec:\n component: \"\"\n version: \"\"\n configuration:\n json:\n raw: []\n features: []\n apispec:\n allowed: []\n",
errString: "",
errorExpected: false,
k8sConfig: []v1alpha1.Configuration{
Expand All @@ -157,7 +157,7 @@ func TestConfigurations(t *testing.T) {
name: "Json one config",
configName: "",
outputFormat: "json",
expectedOutput: "{\n \"name\": \"appConfig\",\n \"spec\": {\n \"httpPipeline\": {\n \"handlers\": null\n },\n \"tracing\": {\n \"samplingRate\": \"\",\n \"zipkin\": {\n \"endpointAddress\": \"\"\n }\n },\n \"metric\": {\n \"enabled\": false\n },\n \"mtls\": {\n \"enabled\": false,\n \"workloadCertTTL\": \"\",\n \"allowedClockSkew\": \"\"\n },\n \"secrets\": {\n \"scopes\": null\n },\n \"accessControl\": {\n \"defaultAction\": \"\",\n \"trustDomain\": \"\",\n \"policies\": null\n }\n }\n}",
expectedOutput: "{\n \"name\": \"appConfig\",\n \"spec\": {\n \"httpPipeline\": {\n \"handlers\": null\n },\n \"tracing\": {\n \"samplingRate\": \"\",\n \"zipkin\": {\n \"endpointAddress\": \"\"\n }\n },\n \"metric\": {\n \"enabled\": false\n },\n \"mtls\": {\n \"enabled\": false,\n \"workloadCertTTL\": \"\",\n \"allowedClockSkew\": \"\"\n },\n \"secrets\": {\n \"scopes\": null\n },\n \"accessControl\": {\n \"defaultAction\": \"\",\n \"trustDomain\": \"\",\n \"policies\": null\n },\n \"nameResolution\": {\n \"component\": \"\",\n \"version\": \"\",\n \"configuration\": null\n },\n \"api\": {}\n }\n}",
errString: "",
errorExpected: false,
k8sConfig: []v1alpha1.Configuration{
Expand All @@ -174,7 +174,7 @@ func TestConfigurations(t *testing.T) {
name: "Json two configs",
configName: "",
outputFormat: "json",
expectedOutput: "[\n {\n \"name\": \"appConfig1\",\n \"spec\": {\n \"httpPipeline\": {\n \"handlers\": null\n },\n \"tracing\": {\n \"samplingRate\": \"\",\n \"zipkin\": {\n \"endpointAddress\": \"\"\n }\n },\n \"metric\": {\n \"enabled\": false\n },\n \"mtls\": {\n \"enabled\": false,\n \"workloadCertTTL\": \"\",\n \"allowedClockSkew\": \"\"\n },\n \"secrets\": {\n \"scopes\": null\n },\n \"accessControl\": {\n \"defaultAction\": \"\",\n \"trustDomain\": \"\",\n \"policies\": null\n }\n }\n },\n {\n \"name\": \"appConfig2\",\n \"spec\": {\n \"httpPipeline\": {\n \"handlers\": null\n },\n \"tracing\": {\n \"samplingRate\": \"\",\n \"zipkin\": {\n \"endpointAddress\": \"\"\n }\n },\n \"metric\": {\n \"enabled\": false\n },\n \"mtls\": {\n \"enabled\": false,\n \"workloadCertTTL\": \"\",\n \"allowedClockSkew\": \"\"\n },\n \"secrets\": {\n \"scopes\": null\n },\n \"accessControl\": {\n \"defaultAction\": \"\",\n \"trustDomain\": \"\",\n \"policies\": null\n }\n }\n }\n]",
expectedOutput: "[\n {\n \"name\": \"appConfig1\",\n \"spec\": {\n \"httpPipeline\": {\n \"handlers\": null\n },\n \"tracing\": {\n \"samplingRate\": \"\",\n \"zipkin\": {\n \"endpointAddress\": \"\"\n }\n },\n \"metric\": {\n \"enabled\": false\n },\n \"mtls\": {\n \"enabled\": false,\n \"workloadCertTTL\": \"\",\n \"allowedClockSkew\": \"\"\n },\n \"secrets\": {\n \"scopes\": null\n },\n \"accessControl\": {\n \"defaultAction\": \"\",\n \"trustDomain\": \"\",\n \"policies\": null\n },\n \"nameResolution\": {\n \"component\": \"\",\n \"version\": \"\",\n \"configuration\": null\n },\n \"api\": {}\n }\n },\n {\n \"name\": \"appConfig2\",\n \"spec\": {\n \"httpPipeline\": {\n \"handlers\": null\n },\n \"tracing\": {\n \"samplingRate\": \"\",\n \"zipkin\": {\n \"endpointAddress\": \"\"\n }\n },\n \"metric\": {\n \"enabled\": false\n },\n \"mtls\": {\n \"enabled\": false,\n \"workloadCertTTL\": \"\",\n \"allowedClockSkew\": \"\"\n },\n \"secrets\": {\n \"scopes\": null\n },\n \"accessControl\": {\n \"defaultAction\": \"\",\n \"trustDomain\": \"\",\n \"policies\": null\n },\n \"nameResolution\": {\n \"component\": \"\",\n \"version\": \"\",\n \"configuration\": null\n },\n \"api\": {}\n }\n }\n]",
errString: "",
errorExpected: false,
k8sConfig: []v1alpha1.Configuration{
Expand Down
5 changes: 3 additions & 2 deletions tests/e2e/kubernetes/kubernetes_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build e2e
// +build e2e

// ------------------------------------------------------------
Expand All @@ -14,8 +15,8 @@ import (
)

const (
currentRuntimeVersion = "1.3.0"
currentDashboardVersion = "0.7.0"
currentRuntimeVersion = "1.5.0"
currentDashboardVersion = "0.9.0"
)

var currentVersionDetails = common.VersionDetails{
Expand Down
31 changes: 18 additions & 13 deletions tests/e2e/standalone/standalone_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,16 @@ import (
)

const (
daprRuntimeVersion = "1.4.0"
daprDashboardVersion = "0.8.0"
daprRuntimeVersion = "1.5.0"
daprDashboardVersion = "0.9.0"
)

var socketCases = []string{"", "/tmp"}
// Removing unix domain socket tests till shutdown API with unix domain sockets is fixed.
// https://github.com/dapr/dapr/issues/3894
var socketCases = []string{""}

func TestStandaloneInstall(t *testing.T) {
// Ensure a clean environment
// Ensure a clean environment.
uninstall()

tests := []struct {
Expand Down Expand Up @@ -248,7 +250,10 @@ func testInstall(t *testing.T) {
return
}
output = strings.TrimSpace(output)
if !assert.Equal(t, version, output) {
// Changing version check since there is a log that is output on daprd --version
// 2021/11/12 11:10:38 maxprocs: Leaving GOMAXPROCS=12: CPU quota undefined
// before the version is output
if !assert.Contains(t, output, version) {
return
}
delete(binaries, bin)
Expand Down Expand Up @@ -377,14 +382,14 @@ func testRun(t *testing.T) {
assert.Contains(t, output, "Exited Dapr successfully")
})

t.Run("API shutdown with socket", func(t *testing.T) {
// Test that the CLI exits on a daprd shutdown.
output, err := spawn.Command(daprPath, "run", "--app-id", "testapp", "--unix-domain-socket", "/tmp", "--", "bash", "-c", "curl --unix-socket /tmp/dapr-testapp-http.socket -v -X POST http://unix/v1.0/shutdown; sleep 10; exit 1")
t.Log(output)
require.NoError(t, err, "run failed")
assert.Contains(t, output, "Exited App successfully", "App should be shutdown before it has a chance to return non-zero")
assert.Contains(t, output, "Exited Dapr successfully")
})
// t.Run("API shutdown with socket", func(t *testing.T) {
// // Test that the CLI exits on a daprd shutdown.
// output, err := spawn.Command(daprPath, "run", "--app-id", "testapp", "--unix-domain-socket", "/tmp", "--", "bash", "-c", "curl --unix-socket /tmp/dapr-testapp-http.socket -v -X POST http://unix/v1.0/shutdown; sleep 10; exit 1")
// t.Log(output)
// require.NoError(t, err, "run failed")
// assert.Contains(t, output, "Exited App successfully", "App should be shutdown before it has a chance to return non-zero")
// assert.Contains(t, output, "Exited Dapr successfully")
// })
}

func executeAgainstRunningDapr(t *testing.T, f func(), daprArgs ...string) {
Expand Down
Loading

0 comments on commit 20c3640

Please sign in to comment.