Skip to content

Commit 2b9d668

Browse files
authored
Merge pull request #7 from hdpriest-ui/enable-kernel-overlay-installs
Enable kernel overlay installs + a few bugfixes
2 parents 93a8def + 8bf30fb commit 2b9d668

File tree

19 files changed

+578
-557
lines changed

19 files changed

+578
-557
lines changed

icrn_manager

Lines changed: 376 additions & 159 deletions
Large diffs are not rendered by default.

tests/test_common.sh

Lines changed: 28 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -159,56 +159,67 @@ setup_test_env() {
159159
mkdir -p "$TEST_REPO/r_kernels"
160160
mkdir -p "$TEST_REPO/python_kernels"
161161

162-
# Create mock catalog
163-
cat > "$TEST_REPO/icrn_kernel_catalog.json" << 'EOF'
162+
# Create mock catalog with paths pointing to test repository
163+
cat > "$TEST_REPO/icrn_kernel_catalog.json" << EOF
164164
{
165165
"R": {
166166
"cowsay": {
167167
"1.0": {
168-
"conda-pack": "cowsay-1.0.tar.gz",
168+
"environment_location": "$TEST_REPO/r_kernels/cowsay/1.0",
169169
"description": "Test R kernel for cowsay package"
170170
}
171171
},
172172
"ggplot2": {
173173
"3.4.0": {
174-
"conda-pack": "ggplot2-3.4.0.tar.gz",
174+
"environment_location": "$TEST_REPO/r_kernels/ggplot2/3.4.0",
175175
"description": "Test R kernel for ggplot2 package"
176176
}
177177
}
178178
},
179179
"Python": {
180180
"numpy": {
181181
"1.24.0": {
182-
"conda-pack": "numpy-1.24.0.tar.gz",
182+
"environment_location": "$TEST_REPO/python_kernels/numpy/1.24.0",
183183
"description": "Test Python kernel for numpy package"
184184
}
185185
}
186186
}
187187
}
188188
EOF
189189

190-
# Create mock kernel packages (valid tar files for testing)
191-
mkdir -p "$TEST_REPO/r_kernels/cowsay/1.0"
192-
mkdir -p "$TEST_REPO/r_kernels/ggplot2/3.4.0"
193-
mkdir -p "$TEST_REPO/python_kernels/numpy/1.24.0"
190+
# Create mock kernel environment directories (in-place environments, not tar files)
191+
mkdir -p "$TEST_REPO/r_kernels/cowsay/1.0/bin"
192+
mkdir -p "$TEST_REPO/r_kernels/ggplot2/3.4.0/bin"
193+
mkdir -p "$TEST_REPO/python_kernels/numpy/1.24.0/bin"
194194

195-
# Create valid tar files with dummy content for testing
196-
echo "dummy content" > "$TEST_REPO/r_kernels/cowsay/1.0/dummy.txt"
197-
tar -czf "$TEST_REPO/r_kernels/cowsay/1.0/cowsay-1.0.tar.gz" -C "$TEST_REPO/r_kernels/cowsay/1.0" dummy.txt 2>/dev/null || true
195+
# Create R kernel mock with conda environment structure
196+
echo "#!/bin/bash" > "$TEST_REPO/r_kernels/cowsay/1.0/bin/activate"
197+
echo "echo 'Activating R conda environment'" >> "$TEST_REPO/r_kernels/cowsay/1.0/bin/activate"
198+
chmod +x "$TEST_REPO/r_kernels/cowsay/1.0/bin/activate"
199+
echo "#!/bin/bash" > "$TEST_REPO/r_kernels/cowsay/1.0/bin/deactivate"
200+
echo "echo 'Deactivating R conda environment'" >> "$TEST_REPO/r_kernels/cowsay/1.0/bin/deactivate"
201+
chmod +x "$TEST_REPO/r_kernels/cowsay/1.0/bin/deactivate"
202+
echo "#!/bin/bash" > "$TEST_REPO/r_kernels/cowsay/1.0/bin/Rscript"
203+
echo "echo '/mock/r/lib'" >> "$TEST_REPO/r_kernels/cowsay/1.0/bin/Rscript"
204+
chmod +x "$TEST_REPO/r_kernels/cowsay/1.0/bin/Rscript"
198205

199-
echo "dummy content" > "$TEST_REPO/r_kernels/ggplot2/3.4.0/dummy.txt"
200-
tar -czf "$TEST_REPO/r_kernels/ggplot2/3.4.0/ggplot2-3.4.0.tar.gz" -C "$TEST_REPO/r_kernels/ggplot2/3.4.0" dummy.txt 2>/dev/null || true
206+
echo "#!/bin/bash" > "$TEST_REPO/r_kernels/ggplot2/3.4.0/bin/activate"
207+
echo "echo 'Activating R conda environment'" >> "$TEST_REPO/r_kernels/ggplot2/3.4.0/bin/activate"
208+
chmod +x "$TEST_REPO/r_kernels/ggplot2/3.4.0/bin/activate"
209+
echo "#!/bin/bash" > "$TEST_REPO/r_kernels/ggplot2/3.4.0/bin/deactivate"
210+
echo "echo 'Deactivating R conda environment'" >> "$TEST_REPO/r_kernels/ggplot2/3.4.0/bin/deactivate"
211+
chmod +x "$TEST_REPO/r_kernels/ggplot2/3.4.0/bin/deactivate"
212+
echo "#!/bin/bash" > "$TEST_REPO/r_kernels/ggplot2/3.4.0/bin/Rscript"
213+
echo "echo '/mock/r/lib'" >> "$TEST_REPO/r_kernels/ggplot2/3.4.0/bin/Rscript"
214+
chmod +x "$TEST_REPO/r_kernels/ggplot2/3.4.0/bin/Rscript"
201215

202216
# Create Python kernel mock with conda environment structure
203-
mkdir -p "$TEST_REPO/python_kernels/numpy/1.24.0/bin"
204-
echo "dummy content" > "$TEST_REPO/python_kernels/numpy/1.24.0/dummy.txt"
205217
echo "#!/bin/bash" > "$TEST_REPO/python_kernels/numpy/1.24.0/bin/activate"
206218
echo "echo 'Activating conda environment'" >> "$TEST_REPO/python_kernels/numpy/1.24.0/bin/activate"
207219
chmod +x "$TEST_REPO/python_kernels/numpy/1.24.0/bin/activate"
208220
echo "#!/bin/bash" > "$TEST_REPO/python_kernels/numpy/1.24.0/bin/deactivate"
209221
echo "echo 'Deactivating conda environment'" >> "$TEST_REPO/python_kernels/numpy/1.24.0/bin/deactivate"
210222
chmod +x "$TEST_REPO/python_kernels/numpy/1.24.0/bin/deactivate"
211-
tar -czf "$TEST_REPO/python_kernels/numpy/1.24.0/numpy-1.24.0.tar.gz" -C "$TEST_REPO/python_kernels/numpy/1.24.0" . 2>/dev/null || true
212223

213224
# Create mock conda-unpack command
214225
echo '#!/bin/bash' > "$TEST_BASE/conda-unpack"

tests/test_env/conda-unpack

Lines changed: 0 additions & 2 deletions
This file was deleted.

tests/test_env/repository/icrn_kernel_catalog.json

Lines changed: 0 additions & 24 deletions
This file was deleted.

tests/test_env/repository/python_kernels/numpy/1.24.0/bin/activate

Lines changed: 0 additions & 2 deletions
This file was deleted.

tests/test_env/repository/python_kernels/numpy/1.24.0/bin/deactivate

Lines changed: 0 additions & 2 deletions
This file was deleted.

tests/test_env/repository/python_kernels/numpy/1.24.0/dummy.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.
Binary file not shown.
-144 Bytes
Binary file not shown.

tests/test_env/repository/r_kernels/cowsay/1.0/dummy.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)