tanmayrauth commented on code in PR #1621:
URL: https://github.com/apache/iceberg-go/pull/1621#discussion_r3691917989


##########
cmd/iceberg/main.go:
##########
@@ -652,8 +652,10 @@ func runProperties(ctx context.Context, output Output, cat 
catalog.Catalog, cmd
                if val, ok := props[get.PropName]; ok {
                        output.Text(val)
                } else {
-                       output.Error(errors.New("could not find property " + 
get.PropName + " on namespace " + get.Identifier))
-                       os.Exit(1)
+                       output.Error(fmt.Errorf("could not find property %s on 
%s %s", get.PropName, get.Type, get.Identifier))
+                       osExit(1)
+
+                       return

Review Comment:
     The `return` here is unreachable — `osExit` is `os.Exit` in prod (never 
returns) and panics in tests, and this is already the end of the case. 
Harmless, but you can drop it.
   



##########
cmd/iceberg/properties_test.go:
##########
@@ -0,0 +1,156 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package main
+
+import (
+       "context"
+       "iter"
+       "testing"
+
+       "github.com/apache/iceberg-go"
+       "github.com/apache/iceberg-go/catalog"
+       "github.com/apache/iceberg-go/table"
+       "github.com/stretchr/testify/assert"
+       "github.com/stretchr/testify/require"
+)
+
+type mockCatalogForProperties struct {
+       tbl            *table.Table
+       nsProps        iceberg.Properties
+       propsGetCalled bool
+}
+
+func (m *mockCatalogForProperties) LoadNamespaceProperties(ctx 
context.Context, namespace table.Identifier) (iceberg.Properties, error) {
+       return m.nsProps, nil
+}
+
+func (m *mockCatalogForProperties) LoadTable(ctx context.Context, ident 
table.Identifier) (*table.Table, error) {
+       return m.tbl, nil
+}
+
+func (m *mockCatalogForProperties) CatalogType() catalog.Type {
+       panic("CatalogType must not be called")
+}
+
+func (m *mockCatalogForProperties) CreateTable(context.Context, 
table.Identifier, *iceberg.Schema, ...catalog.CreateTableOpt) (*table.Table, 
error) {
+       panic("CreateTable must not be called")
+}
+
+func (m *mockCatalogForProperties) CommitTable(context.Context, 
table.Identifier, []table.Requirement, []table.Update) (table.Metadata, string, 
error) {
+       panic("CommitTable must not be called")
+}
+
+func (m *mockCatalogForProperties) ListTables(context.Context, 
table.Identifier) iter.Seq2[table.Identifier, error] {
+       panic("ListTables must not be called")
+}
+
+func (m *mockCatalogForProperties) DropTable(context.Context, 
table.Identifier) error {
+       panic("DropTable must not be called")
+}
+
+func (m *mockCatalogForProperties) RenameTable(context.Context, 
table.Identifier, table.Identifier) (*table.Table, error) {
+       panic("RenameTable must not be called")
+}
+
+func (m *mockCatalogForProperties) CheckTableExists(context.Context, 
table.Identifier) (bool, error) {
+       panic("CheckTableExists must not be called")
+}
+
+func (m *mockCatalogForProperties) ListNamespaces(context.Context, 
table.Identifier) ([]table.Identifier, error) {
+       panic("ListNamespaces must not be called")
+}
+
+func (m *mockCatalogForProperties) CreateNamespace(context.Context, 
table.Identifier, iceberg.Properties) error {
+       panic("CreateNamespace must not be called")
+}
+
+func (m *mockCatalogForProperties) DropNamespace(context.Context, 
table.Identifier) error {
+       panic("DropNamespace must not be called")
+}
+
+func (m *mockCatalogForProperties) CheckNamespaceExists(context.Context, 
table.Identifier) (bool, error) {
+       panic("CheckNamespaceExists must not be called")
+}
+
+func (m *mockCatalogForProperties) UpdateNamespaceProperties(context.Context, 
table.Identifier, []string, iceberg.Properties) 
(catalog.PropertiesUpdateSummary, error) {
+       panic("UpdateNamespaceProperties must not be called")
+}
+
+func TestRunPropertiesGetNamespaceNotFound로(t *testing.T) {

Review Comment:
   The test name `TestRunPropertiesGetNamespaceNotFound로` has a stray Korean 
character `로` on the end — looks like an accidental keystroke. It compiles and 
runs (Go allows Unicode identifiers), but it shows up as garbage in CI logs and 
when grepping test names, and it's inconsistent with the sibling 
`TestRunPropertiesGetTableNotFound`. Rename to 
`TestRunPropertiesGetNamespaceNotFound`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to