From 0f3a74620ad02b85a6324e2527cd8c7973dc528f Mon Sep 17 00:00:00 2001 From: shahramn Date: Fri, 21 Jun 2024 13:51:03 +0100 Subject: [PATCH] ECC-1846: Make keys read-only --- definitions/grib2/local/ecmf/section4_extras.def | 4 ++-- tests/grib_ecc-1846.sh | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/definitions/grib2/local/ecmf/section4_extras.def b/definitions/grib2/local/ecmf/section4_extras.def index 23b304b7d..0727c4b9a 100644 --- a/definitions/grib2/local/ecmf/section4_extras.def +++ b/definitions/grib2/local/ecmf/section4_extras.def @@ -2,10 +2,10 @@ # See ECC-1846 if (centre is "ecmf" or datasetForLocal is "era6") { - concept_nofail modelName(unknown, "modelNameConcept.def", conceptsMasterDir, conceptsLocalDirAll): no_copy, dump; + concept_nofail modelName(unknown, "modelNameConcept.def", conceptsMasterDir, conceptsLocalDirAll): no_copy, dump, read_only; if (!(modelName is "unknown")) { - concept_nofail modelVersion(unknown, "modelVersionConcept_[modelName].def", conceptsMasterDir, conceptsLocalDirAll): no_copy, dump; + concept_nofail modelVersion(unknown, "modelVersionConcept_[modelName].def", conceptsMasterDir, conceptsLocalDirAll): no_copy, dump, read_only; # alias ls.model = modelName; # alias mars.model = modelName; } diff --git a/tests/grib_ecc-1846.sh b/tests/grib_ecc-1846.sh index 270579ad0..1416cf1e7 100755 --- a/tests/grib_ecc-1846.sh +++ b/tests/grib_ecc-1846.sh @@ -28,5 +28,21 @@ grib_check_key_equals $tempGrib modelName,modelVersion "IFS cy48r1" ${tools_dir}/grib_set -s generatingProcessIdentifier=100 $sample $tempGrib grib_check_key_equals $tempGrib modelName,modelVersion "IFS unknown" +# Keys are read-only (may change this later) +set +e +${tools_dir}/grib_set -s modelName=AIFS $sample $tempGrib 2>$tempLog +status=$? +set -e +[ $status -ne 0 ] +grep -q "Value is read only" $tempLog + +set +e +${tools_dir}/grib_set -s modelVersion=cy48r1 $sample $tempGrib 2>$tempLog +status=$? +set -e +[ $status -ne 0 ] +grep -q "Value is read only" $tempLog + + # Clean up rm -f $tempGrib $tempFilt $tempLog $tempOut $tempRef