Grant needed privileges for snapshotter tests
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
This commit is contained in:
		| @@ -22,7 +22,6 @@ import ( | |||||||
|  |  | ||||||
| 	. "github.com/containerd/containerd" | 	. "github.com/containerd/containerd" | ||||||
| 	"github.com/containerd/containerd/snapshots" | 	"github.com/containerd/containerd/snapshots" | ||||||
| 	"github.com/containerd/containerd/snapshots/testsuite" |  | ||||||
| ) | ) | ||||||
|  |  | ||||||
| func newSnapshotter(ctx context.Context, root string) (snapshots.Snapshotter, func() error, error) { | func newSnapshotter(ctx context.Context, root string) (snapshots.Snapshotter, func() error, error) { | ||||||
| @@ -40,8 +39,5 @@ func newSnapshotter(ctx context.Context, root string) (snapshots.Snapshotter, fu | |||||||
| } | } | ||||||
|  |  | ||||||
| func TestSnapshotterClient(t *testing.T) { | func TestSnapshotterClient(t *testing.T) { | ||||||
| 	if testing.Short() { | 	runTestSnapshotterClient(t) | ||||||
| 		t.Skip() |  | ||||||
| 	} |  | ||||||
| 	testsuite.SnapshotterSuite(t, "SnapshotterClient", newSnapshotter) |  | ||||||
| } | } | ||||||
|   | |||||||
							
								
								
									
										34
									
								
								integration/client/snapshot_unix_test.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								integration/client/snapshot_unix_test.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,34 @@ | |||||||
|  | //go:build !windows | ||||||
|  | // +build !windows | ||||||
|  |  | ||||||
|  | /* | ||||||
|  |    Copyright The containerd Authors. | ||||||
|  |  | ||||||
|  |    Licensed 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. | ||||||
|  | */ | ||||||
|  |  | ||||||
|  | package client | ||||||
|  |  | ||||||
|  | import ( | ||||||
|  | 	"testing" | ||||||
|  |  | ||||||
|  | 	"github.com/containerd/containerd/snapshots/testsuite" | ||||||
|  | ) | ||||||
|  |  | ||||||
|  | func runTestSnapshotterClient(t *testing.T) { | ||||||
|  | 	if testing.Short() { | ||||||
|  | 		t.Skip() | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	testsuite.SnapshotterSuite(t, "SnapshotterClient", newSnapshotter) | ||||||
|  | } | ||||||
							
								
								
									
										39
									
								
								integration/client/snapshot_windows_test.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										39
									
								
								integration/client/snapshot_windows_test.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,39 @@ | |||||||
|  | //go:build windows | ||||||
|  | // +build windows | ||||||
|  |  | ||||||
|  | /* | ||||||
|  | Copyright The containerd Authors. | ||||||
|  |  | ||||||
|  | Licensed 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. | ||||||
|  | */ | ||||||
|  | package client | ||||||
|  |  | ||||||
|  | import ( | ||||||
|  | 	"testing" | ||||||
|  |  | ||||||
|  | 	winio "github.com/Microsoft/go-winio" | ||||||
|  | 	"github.com/containerd/containerd/snapshots/testsuite" | ||||||
|  | ) | ||||||
|  |  | ||||||
|  | func runTestSnapshotterClient(t *testing.T) { | ||||||
|  | 	if testing.Short() { | ||||||
|  | 		t.Skip() | ||||||
|  | 	} | ||||||
|  | 	// The SeBackupPrivilege and SeRestorePrivilege gives us access to system files inside the container mount points | ||||||
|  | 	// (and everywhere on the system), without having to explicitly set DACLs on each location inside the mount point. | ||||||
|  | 	if err := winio.EnableProcessPrivileges([]string{winio.SeBackupPrivilege, winio.SeRestorePrivilege}); err != nil { | ||||||
|  | 		t.Error(err) | ||||||
|  | 	} | ||||||
|  | 	defer winio.DisableProcessPrivileges([]string{winio.SeBackupPrivilege, winio.SeRestorePrivilege}) | ||||||
|  | 	testsuite.SnapshotterSuite(t, "SnapshotterClient", newSnapshotter) | ||||||
|  | } | ||||||
		Reference in New Issue
	
	Block a user
	 Gabriel Adrian Samfira
					Gabriel Adrian Samfira