forked from Plemya-x/ALR
		
	fix: removerepo and LC_ALL=C for info command
This commit is contained in:
		@@ -19,33 +19,52 @@
 | 
			
		||||
package e2etests_test
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"regexp"
 | 
			
		||||
	"bytes"
 | 
			
		||||
	"testing"
 | 
			
		||||
	"time"
 | 
			
		||||
 | 
			
		||||
	"github.com/efficientgo/e2e"
 | 
			
		||||
	expect "github.com/tailscale/goexpect"
 | 
			
		||||
	"github.com/stretchr/testify/assert"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func TestE2EAlrAddRepo(t *testing.T) {
 | 
			
		||||
	dockerMultipleRun(
 | 
			
		||||
		t,
 | 
			
		||||
		"add-repo",
 | 
			
		||||
		"add-repo-remove-repo",
 | 
			
		||||
		COMMON_SYSTEMS,
 | 
			
		||||
		func(t *testing.T, r e2e.Runnable) {
 | 
			
		||||
			runTestCommands(t, r, time.Second*10, []expect.Batcher{
 | 
			
		||||
				&expect.BSnd{S: "alr addrepo --name alr-repo --url https://gitea.plemya-x.ru/Plemya-x/alr-repo.git ; echo ALR-ADD-REPO-RETURN-CODE $?\n"},
 | 
			
		||||
				&expect.BCas{C: []expect.Caser{
 | 
			
		||||
					&expect.Case{
 | 
			
		||||
						R: regexp.MustCompile(`ALR-ADD-REPO-RETURN-CODE 0\n$`),
 | 
			
		||||
						T: expect.OK(),
 | 
			
		||||
					},
 | 
			
		||||
					&expect.Case{
 | 
			
		||||
						R: regexp.MustCompile(`ALR-ADD-REPO-RETURN-CODE \d\n$`),
 | 
			
		||||
						T: expect.Fail(expect.NewStatus(expect.Internal, "Unexpected return code!")),
 | 
			
		||||
					},
 | 
			
		||||
				}},
 | 
			
		||||
			})
 | 
			
		||||
			err := r.Exec(e2e.NewCommand(
 | 
			
		||||
				"alr",
 | 
			
		||||
				"addrepo",
 | 
			
		||||
				"--name",
 | 
			
		||||
				"alr-repo",
 | 
			
		||||
				"--url",
 | 
			
		||||
				"https://gitea.plemya-x.ru/Plemya-x/alr-repo.git",
 | 
			
		||||
			))
 | 
			
		||||
			assert.NoError(t, err)
 | 
			
		||||
 | 
			
		||||
			err = r.Exec(e2e.NewCommand(
 | 
			
		||||
				"bash",
 | 
			
		||||
				"-c",
 | 
			
		||||
				"cat $HOME/.config/alr/alr.toml",
 | 
			
		||||
			))
 | 
			
		||||
			assert.NoError(t, err)
 | 
			
		||||
 | 
			
		||||
			err = r.Exec(e2e.NewCommand(
 | 
			
		||||
				"alr",
 | 
			
		||||
				"removerepo",
 | 
			
		||||
				"--name",
 | 
			
		||||
				"alr-repo",
 | 
			
		||||
			))
 | 
			
		||||
			assert.NoError(t, err)
 | 
			
		||||
 | 
			
		||||
			var buf bytes.Buffer
 | 
			
		||||
			err = r.Exec(e2e.NewCommand(
 | 
			
		||||
				"bash",
 | 
			
		||||
				"-c",
 | 
			
		||||
				"cat $HOME/.config/alr/alr.toml",
 | 
			
		||||
			), e2e.WithExecOptionStdout(&buf))
 | 
			
		||||
			assert.NoError(t, err)
 | 
			
		||||
			assert.Contains(t, buf.String(), "rootCmd")
 | 
			
		||||
		},
 | 
			
		||||
	)
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										52
									
								
								e2e-tests/issue_53_lc_all_c_info_test.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										52
									
								
								e2e-tests/issue_53_lc_all_c_info_test.go
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,52 @@
 | 
			
		||||
// ALR - Any Linux Repository
 | 
			
		||||
// Copyright (C) 2025 Евгений Храмов
 | 
			
		||||
//
 | 
			
		||||
// This program is free software: you can redistribute it and/or modify
 | 
			
		||||
// it under the terms of the GNU General Public License as published by
 | 
			
		||||
// the Free Software Foundation, either version 3 of the License, or
 | 
			
		||||
// (at your option) any later version.
 | 
			
		||||
//
 | 
			
		||||
// This program is distributed in the hope that it will be useful,
 | 
			
		||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
// GNU General Public License for more details.
 | 
			
		||||
//
 | 
			
		||||
// You should have received a copy of the GNU General Public License
 | 
			
		||||
// along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 | 
			
		||||
//go:build e2e
 | 
			
		||||
 | 
			
		||||
package e2etests_test
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"testing"
 | 
			
		||||
 | 
			
		||||
	"github.com/alecthomas/assert/v2"
 | 
			
		||||
	"github.com/efficientgo/e2e"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func TestE2EIssue53LcAllCInfo(t *testing.T) {
 | 
			
		||||
	dockerMultipleRun(
 | 
			
		||||
		t,
 | 
			
		||||
		"issue-53-lc-all-c-info",
 | 
			
		||||
		COMMON_SYSTEMS,
 | 
			
		||||
		func(t *testing.T, r e2e.Runnable) {
 | 
			
		||||
			err := r.Exec(e2e.NewCommand(
 | 
			
		||||
				"alr",
 | 
			
		||||
				"addrepo",
 | 
			
		||||
				"--name",
 | 
			
		||||
				"alr-repo",
 | 
			
		||||
				"--url",
 | 
			
		||||
				"https://gitea.plemya-x.ru/Plemya-x/alr-repo.git",
 | 
			
		||||
			))
 | 
			
		||||
			assert.NoError(t, err)
 | 
			
		||||
 | 
			
		||||
			err = r.Exec(e2e.NewCommand(
 | 
			
		||||
				"bash",
 | 
			
		||||
				"-c",
 | 
			
		||||
				"LANG=C alr info alr-bin",
 | 
			
		||||
			))
 | 
			
		||||
			assert.NoError(t, err)
 | 
			
		||||
		},
 | 
			
		||||
	)
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user