Skip to content

World's most powerful open data catalog for building a high-performance, geo-distributed and federated metadata lake.

8.5 KB
Raw Blame
#
# 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.
#

suite: test gravitino iceberg rest server configmap
templates:
  - configmap.yaml
tests:
  - it: renders default config files
    release:
      name: iceberg-rest
      namespace: iceberg-system
    asserts:
      - isKind:
          of: ConfigMap
      - equal:
          path: metadata.name
          value: iceberg-rest-gravitino-iceberg-rest-server-helm
      - equal:
          path: metadata.namespace
          value: iceberg-system
      - exists:
          path: data["init.sh"]
      - exists:
          path: data["gravitino-iceberg-rest-server.conf"]
      - exists:
          path: data["gravitino-iceberg-rest-log4j2.properties"]
      - exists:
          path: data["core-site.xml"]
      - exists:
          path: data["hdfs-site.xml"]
      - matchRegex:
          path: data["init.sh"]
          pattern: "exec /bin/bash .*/start-iceberg-rest-server\\.sh"
      - matchRegex:
          path: data["gravitino-iceberg-rest-server.conf"]
          pattern: "gravitino\\.iceberg-rest\\.httpPort = 9001"
      - matchRegex:
          path: data["gravitino-iceberg-rest-server.conf"]
          pattern: "gravitino\\.iceberg-rest\\.catalog-backend = memory"
      - matchRegex:
          path: data["gravitino-iceberg-rest-server.conf"]
          pattern: "gravitino\\.iceberg-rest\\.warehouse = /tmp/"
      - matchRegex:
          path: data["gravitino-iceberg-rest-log4j2.properties"]
          pattern: "rootLogger\\.level = info"
      - matchRegex:
          path: data["gravitino-iceberg-rest-log4j2.properties"]
          pattern: "appender\\.console\\.type = Console"

  - it: renders customized Iceberg REST and log4j configuration
    release:
      name: custom-iceberg-rest
    set:
      icebergRest:
        httpPort: 19001
        catalogBackend: jdbc
        warehouse: s3://warehouse/iceberg
        uri: jdbc:postgresql://postgresql:5432/iceberg
        catalogBackendName: jdbc_catalog
        ioImpl: org.apache.iceberg.aws.s3.S3FileIO
        credentialProviders: s3-token
        jdbc:
          user: iceberg_user
          password: iceberg_password
          initialize: true
          driver: org.postgresql.Driver
          schemaVersion: V1
        s3:
          accessKeyId: access_key
          secretAccessKey: secret_key
          endpoint: http://minio:9000
          region: us-east-1
          pathStyleAccess: true
        dynamicConfigProvider:
          uri: http://gravitino:8090
          metalake: metalake_demo
          defaultCatalogName: iceberg_catalog
      additionalConfigItems:
        gravitino.iceberg-rest.custom.setting: "{{ .Release.Name }}"
      log4j2Properties:
        rootLoggerLevel: debug
      additionalLog4j2Properties:
        logger.custom.name: org.apache.gravitino.Custom
    asserts:
      - matchRegex:
          path: data["gravitino-iceberg-rest-server.conf"]
          pattern: "gravitino\\.iceberg-rest\\.httpPort = 19001"
      - matchRegex:
          path: data["gravitino-iceberg-rest-server.conf"]
          pattern: "gravitino\\.iceberg-rest\\.catalog-backend = jdbc"
      - matchRegex:
          path: data["gravitino-iceberg-rest-server.conf"]
          pattern: "gravitino\\.iceberg-rest\\.warehouse = s3://warehouse/iceberg"
      - matchRegex:
          path: data["gravitino-iceberg-rest-server.conf"]
          pattern: "gravitino\\.iceberg-rest\\.uri = jdbc:postgresql://postgresql:5432/iceberg"
      - matchRegex:
          path: data["gravitino-iceberg-rest-server.conf"]
          pattern: "gravitino\\.iceberg-rest\\.jdbc-user = iceberg_user"
      - matchRegex:
          path: data["gravitino-iceberg-rest-server.conf"]
          pattern: "gravitino\\.iceberg-rest\\.jdbc-initialize = true"
      - matchRegex:
          path: data["gravitino-iceberg-rest-server.conf"]
          pattern: "gravitino\\.iceberg-rest\\.jdbc\\.schema-version = V1"
      - matchRegex:
          path: data["gravitino-iceberg-rest-server.conf"]
          pattern: "gravitino\\.iceberg-rest\\.s3-endpoint = http://minio:9000"
      - matchRegex:
          path: data["gravitino-iceberg-rest-server.conf"]
          pattern: "gravitino\\.iceberg-rest\\.gravitino-metalake = metalake_demo"
      - matchRegex:
          path: data["gravitino-iceberg-rest-server.conf"]
          pattern: "gravitino\\.iceberg-rest\\.custom\\.setting = custom-iceberg-rest"
      - matchRegex:
          path: data["gravitino-iceberg-rest-log4j2.properties"]
          pattern: "rootLogger\\.level = debug"
      - matchRegex:
          path: data["gravitino-iceberg-rest-log4j2.properties"]
          pattern: "logger\\.custom\\.name = org\\.apache\\.gravitino\\.Custom"

  - it: renders Hadoop XML properties
    set:
      coreSiteProperties:
        fs.defaultFS: hdfs://namenode:8020
      hdfsSiteProperties:
        dfs.replication: "3"
    asserts:
      - matchRegex:
          path: data["core-site.xml"]
          pattern: "<name>fs\\.defaultFS</name>"
      - matchRegex:
          path: data["core-site.xml"]
          pattern: "<value>hdfs://namenode:8020</value>"
      - matchRegex:
          path: data["hdfs-site.xml"]
          pattern: "<name>dfs\\.replication</name>"
      - matchRegex:
          path: data["hdfs-site.xml"]
          pattern: "<value>3</value>"

  - it: renders log rotation and retention defaults
    release:
      name: iceberg-rest
    asserts:
      - matchRegex:
          path: data["gravitino-iceberg-rest-log4j2.properties"]
          pattern: "property\\.logMaxAge = 30d"
      - matchRegex:
          path: data["gravitino-iceberg-rest-log4j2.properties"]
          pattern: "property\\.serverLogMaxTotalSize = 2GB"
      - matchRegex:
          path: data["gravitino-iceberg-rest-log4j2.properties"]
          pattern: "appender\\.rolling\\.filePattern = \\$\\{basePath\\}/\\$\\{serverName\\}_%d\\{yyyyMMdd\\}\\.%i\\.log\\.gz"
      - matchRegex:
          path: data["gravitino-iceberg-rest-log4j2.properties"]
          pattern: "appender\\.rolling\\.policies\\.size\\.size = 100MB"
      - matchRegex:
          path: data["gravitino-iceberg-rest-log4j2.properties"]
          pattern: "appender\\.rolling\\.strategy\\.fileIndex = nomax"
      - matchRegex:
          path: data["gravitino-iceberg-rest-log4j2.properties"]
          pattern: "appender\\.rolling\\.strategy\\.delete\\.maxDepth = 1"
      - matchRegex:
          path: data["gravitino-iceberg-rest-log4j2.properties"]
          pattern: "appender\\.rolling\\.strategy\\.delete\\.ifFileName\\.glob = \\$\\{serverName\\}_\\*\\.log\\.gz"
      - matchRegex:
          path: data["gravitino-iceberg-rest-log4j2.properties"]
          pattern: "appender\\.rolling\\.strategy\\.delete\\.ifFileName\\.ifAny\\.ifAccumulatedFileSize\\.exceeds = \\$\\{serverLogMaxTotalSize\\}"
      - matchRegex:
          path: data["gravitino-iceberg-rest-log4j2.properties"]
          pattern: "appender\\.rolling\\.strategy\\.delete\\.ifFileName\\.ifAny\\.ifLastModified\\.age = \\$\\{logMaxAge\\}"

  - it: renders customized log retention
    release:
      name: iceberg-rest
    set:
      log4j2Properties:
        logMaxAge: 7d
        serverLogMaxTotalSize: 500MB
        rollingAppenderPoliciesSizeSize: 20MB
        rollingAppenderStrategyDeleteIfFileNameGlob: "app_*.log.gz"
    asserts:
      - matchRegex:
          path: data["gravitino-iceberg-rest-log4j2.properties"]
          pattern: "property\\.logMaxAge = 7d"
      - matchRegex:
          path: data["gravitino-iceberg-rest-log4j2.properties"]
          pattern: "property\\.serverLogMaxTotalSize = 500MB"
      - matchRegex:
          path: data["gravitino-iceberg-rest-log4j2.properties"]
          pattern: "appender\\.rolling\\.policies\\.size\\.size = 20MB"
      - matchRegex:
          path: data["gravitino-iceberg-rest-log4j2.properties"]
          pattern: "appender\\.rolling\\.strategy\\.delete\\.ifFileName\\.glob = app_\\*\\.log\\.gz"