Skip to content

Commit

Permalink
Remove Lua transformation
Browse files Browse the repository at this point in the history
  • Loading branch information
adatzer committed Jun 20, 2024
1 parent e594770 commit 58e6711
Show file tree
Hide file tree
Showing 30 changed files with 3 additions and 2,013 deletions.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,3 @@ transform {
script_path = env.JS_ERROR_PATH
}
}

transform {
use "lua" {
timeout_sec = 15
script_path = env.LUA_ADD_HELLO_PATH
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,3 @@ transform {
script_path = env.JS_ALTER_AID_2_PATH
}
}

transform {
use "lua" {
script_path = env.LUA_ADD_HELLO_PATH
}
}

This file was deleted.

This file was deleted.

This file was deleted.

27 changes: 0 additions & 27 deletions docs/configuration_transformations_docs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,18 +65,12 @@ func TestScriptTransformationCustomScripts(t *testing.T) {
// Set env vars with paths to scripts
t.Setenv("JS_SCRIPT_PATH", jsScriptPath)

luaScriptPath := filepath.Join(assets.AssetsRootDir, "docs", "configuration", "transformations", "custom-scripts", "create-a-script-filter-example.lua")
t.Setenv("LUA_SCRIPT_PATH", luaScriptPath)

jsNonSnowplowScriptPath := filepath.Join(assets.AssetsRootDir, "docs", "configuration", "transformations", "custom-scripts", "examples", "js-non-snowplow-script-example.js")
t.Setenv("JS_NON_SNOWPLOW_SCRIPT_PATH", jsNonSnowplowScriptPath)

jsSnowplowScriptPath := filepath.Join(assets.AssetsRootDir, "docs", "configuration", "transformations", "custom-scripts", "examples", "js-snowplow-script-example.js")
t.Setenv("JS_SNOWPLOW_SCRIPT_PATH", jsSnowplowScriptPath)

luaNonSnowplowScriptPath := filepath.Join(assets.AssetsRootDir, "docs", "configuration", "transformations", "custom-scripts", "examples", "lua-script-example.lua")
t.Setenv("LUA_SCRIPT_EXAMPLE_PATH", luaNonSnowplowScriptPath)

baseDir := filepath.Join(assets.AssetsRootDir, "docs", "configuration", "transformations", "custom-scripts")

filesInBaseDir, err := ioutil.ReadDir(baseDir)
Expand Down Expand Up @@ -109,9 +103,6 @@ func TestScriptTransformationCustomScripts(t *testing.T) {
case ".js":
// Test that all of our JS snippets compile with the engine, pass smoke test, and successfully create a transformation function
testJSScriptCompiles(t, file)
case ".lua":
// Test that all of our Lua snippets compile with the engine, pass smoke test, and successfully create a transformation function
testLuaScriptCompiles(t, file)
case ".hcl":
isFull := strings.Contains(file, "full-example")

Expand Down Expand Up @@ -168,8 +159,6 @@ func testTransformationConfig(t *testing.T, filepath string, fullExample bool) {
configObject = &transform.GTMSSPreviewConfig{}
case "js":
configObject = &engine.JSEngineConfig{}
case "lua":
configObject = &engine.LuaEngineConfig{}
default:
assert.Fail(fmt.Sprint("Source not recognised: ", use.Name))
}
Expand Down Expand Up @@ -212,19 +201,3 @@ func testJSScriptCompiles(t *testing.T, scriptPath string) {
}

}

func testLuaScriptCompiles(t *testing.T, scriptPath string) {
assert := assert.New(t)

luaConfig := &engine.LuaEngineConfig{
ScriptPath: scriptPath,
RunTimeout: 5, // This is needed here as we're providing config directly, not using defaults.
}

// LuaConfigFunction validates and smoke tests the function, and only returns valid transformation functions.
luaTransformationFunction, err := engine.LuaConfigFunction(luaConfig)
assert.NotNil(luaTransformationFunction, scriptPath)
if err != nil {
t.Fatalf("NewLuaEngine failed with error: %s. Script: %s", err.Error(), string(scriptPath))
}
}
3 changes: 0 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,7 @@ require (
github.com/itchyny/gojq v0.12.16
github.com/json-iterator/go v1.1.12
github.com/snowplow/snowplow-golang-tracker/v2 v2.4.1
github.com/yuin/gluamapper v0.0.0-20150323120927-d836955830e7
github.com/yuin/gopher-lua v1.1.1
github.com/zclconf/go-cty v1.14.4
layeh.com/gopher-json v0.0.0-20201124131017-552bb3c4c3bf
)

require (
Expand Down
6 changes: 0 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -394,11 +394,7 @@ github.com/yalp/jsonpath v0.0.0-20180802001716-5cc68e5049a0/go.mod h1:/LWChgwKmv
github.com/yudai/gojsondiff v1.0.0/go.mod h1:AY32+k2cwILAkW1fbgxQ5mUmMiZFgLIV+FBNExI05xg=
github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82/go.mod h1:lgjkn3NuSvDfVJdfcVVdX+jpBxNmX4rDAzaS45IcYoM=
github.com/yudai/pp v2.0.1+incompatible/go.mod h1:PuxR/8QJ7cyCkFp/aUDS+JY727OFEZkTdatxwunjIkc=
github.com/yuin/gluamapper v0.0.0-20150323120927-d836955830e7 h1:noHsffKZsNfU38DwcXWEPldrTjIZ8FPNKx8mYMGnqjs=
github.com/yuin/gluamapper v0.0.0-20150323120927-d836955830e7/go.mod h1:bbMEM6aU1WDF1ErA5YJ0p91652pGv140gGw4Ww3RGp8=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
github.com/yuin/gopher-lua v1.1.1 h1:kYKnWBjvbNP4XLT3+bPEwAXJx262OhaHDWDVOPjL46M=
github.com/yuin/gopher-lua v1.1.1/go.mod h1:GBR0iDaNXjAgGg9zfCvksxSRnQx76gclCIb7kdAd1Pw=
github.com/zclconf/go-cty v1.14.4 h1:uXXczd9QDGsgu0i/QFR/hzI5NYCHLf6NQw/atrbnhq8=
github.com/zclconf/go-cty v1.14.4/go.mod h1:VvMs5i0vgZdhYawQNq5kePSpLAoz8u1xvZgrPIxfnZE=
github.com/zclconf/go-cty-debug v0.0.0-20191215020915-b22d67c1ba0b h1:FosyBZYxY34Wul7O/MSKey3txpPYyCqVO5ZyceuQJEI=
Expand Down Expand Up @@ -578,5 +574,3 @@ gotest.tools/v3 v3.5.1 h1:EENdUnS3pdur5nybKYIh2Vfgc8IUNBjxDPSjtiJcOzU=
gotest.tools/v3 v3.5.1/go.mod h1:isy3WKz7GK6uNw/sbHzfKBLvlvXwUyV06n6brMxxopU=
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
layeh.com/gopher-json v0.0.0-20201124131017-552bb3c4c3bf h1:rRz0YsF7VXj9fXRF6yQgFI7DzST+hsI3TeFSGupntu0=
layeh.com/gopher-json v0.0.0-20201124131017-552bb3c4c3bf/go.mod h1:ivKkcY8Zxw5ba0jldhZCYYQfGdb2K6u9tbYK1AwMIBc=
Loading

0 comments on commit 58e6711

Please sign in to comment.