Skip to content

Commit fe1fad0

Browse files
committed
Address comments
1 parent c5fb88c commit fe1fad0

4 files changed

Lines changed: 24 additions & 16 deletions

File tree

internal/config/default_config.toml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,6 @@ port = "4566" # Host port the emulator will be accessible on
1212
# volume = "" # Host directory for persistent state (default: OS cache dir)
1313
# env = [] # Named environment profiles to apply (see [env.*] sections below)
1414

15-
# To use the Snowflake emulator instead, comment out the AWS block above and uncomment this one.
16-
# [[containers]]
17-
# type = "snowflake"
18-
# tag = "latest"
19-
# port = "4566"
20-
2115
# Environment profiles let you group environment variables and reference
2216
# them by name in one or more containers via the 'env' field above.
2317
#

internal/container/label.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ func ResolveEmulatorLabel(ctx context.Context, client api.PlatformAPI, container
3232
tag := c.Tag
3333
if tag == "" || tag == "latest" {
3434
if c.Type == config.EmulatorSnowflake {
35-
return "LocalStack Snowflake", false
35+
return "LocalStack", false
3636
}
3737
apiCtx, cancel := context.WithTimeout(ctx, 2*time.Second)
3838
v, err := client.GetLatestCatalogVersion(apiCtx, string(c.Type))

internal/container/start.go

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -235,22 +235,24 @@ func runPostStartSetups(ctx context.Context, sink output.Sink, containers []conf
235235
if err := setup(ctx, sink, interactive, resolvedHost); err != nil {
236236
return err
237237
}
238-
emitPostStartPointers(sink, resolvedHost, webAppURL)
238+
emitPostStartPointers(sink, resolvedHost, webAppURL, true)
239239
}
240240
}
241241
return nil
242242
}
243243

244-
func emitPostStartPointers(sink output.Sink, resolvedHost, webAppURL string) {
244+
func emitPostStartPointers(sink output.Sink, resolvedHost, webAppURL string, showTip bool) {
245245
output.EmitSecondary(sink, fmt.Sprintf("• Endpoint: %s", resolvedHost))
246246
if webAppURL != "" {
247247
output.EmitSecondary(sink, fmt.Sprintf("• Web app: %s", strings.TrimRight(webAppURL, "/")))
248248
}
249-
tips := []string{
250-
"> Tip: View emulator logs: lstk logs --follow",
251-
"> Tip: View deployed resources: lstk status",
249+
if showTip {
250+
tips := []string{
251+
"> Tip: View emulator logs: lstk logs --follow",
252+
"> Tip: View deployed resources: lstk status",
253+
}
254+
output.EmitSecondary(sink, tips[rand.IntN(len(tips))])
252255
}
253-
output.EmitSecondary(sink, tips[rand.IntN(len(tips))])
254256
}
255257

256258
func pullImages(ctx context.Context, rt runtime.Runtime, sink output.Sink, tel *telemetry.Client, containers []runtime.ContainerConfig) (map[string]bool, error) {
@@ -377,7 +379,7 @@ func selectContainersToStart(ctx context.Context, rt runtime.Runtime, sink outpu
377379
if !dnsOK {
378380
output.EmitNote(sink, endpoint.DNSRebindNote)
379381
}
380-
emitPostStartPointers(sink, resolvedHost, webAppURL)
382+
emitPostStartPointers(sink, resolvedHost, webAppURL, c.EmulatorType == string(config.EmulatorAWS))
381383
continue
382384
}
383385

internal/container/start_test.go

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func TestEmitPostStartPointers_WithWebApp(t *testing.T) {
3636
var out bytes.Buffer
3737
sink := output.NewPlainSink(&out)
3838

39-
emitPostStartPointers(sink, "localhost.localstack.cloud:4566", "https://app.localstack.cloud/")
39+
emitPostStartPointers(sink, "localhost.localstack.cloud:4566", "https://app.localstack.cloud/", true)
4040

4141
got := out.String()
4242
assert.Contains(t, got, "• Endpoint: localhost.localstack.cloud:4566\n")
@@ -48,7 +48,7 @@ func TestEmitPostStartPointers_WithoutWebApp(t *testing.T) {
4848
var out bytes.Buffer
4949
sink := output.NewPlainSink(&out)
5050

51-
emitPostStartPointers(sink, "127.0.0.1:4566", "")
51+
emitPostStartPointers(sink, "127.0.0.1:4566", "", true)
5252

5353
got := out.String()
5454
assert.Contains(t, got, "• Endpoint: 127.0.0.1:4566\n")
@@ -138,6 +138,18 @@ func TestSelectContainersToStart_QueuesContainerWhenNoneRunningOnPort(t *testing
138138
assert.Equal(t, []runtime.ContainerConfig{c}, result, "container should be queued for start")
139139
}
140140

141+
func TestEmitPostStartPointers_NoTip(t *testing.T) {
142+
var out bytes.Buffer
143+
sink := output.NewPlainSink(&out)
144+
145+
emitPostStartPointers(sink, "localhost.localstack.cloud:4566", "https://app.localstack.cloud/", false)
146+
147+
got := out.String()
148+
assert.Contains(t, got, "• Endpoint: localhost.localstack.cloud:4566\n")
149+
assert.Contains(t, got, "• Web app: https://app.localstack.cloud\n")
150+
assert.NotContains(t, got, "> Tip:")
151+
}
152+
141153
func TestServicePortRange_ReturnsExpectedPorts(t *testing.T) {
142154
ports := servicePortRange()
143155

0 commit comments

Comments
 (0)